diff options
author | Russ Cox <rsc@golang.org> | 2017-02-13 09:24:05 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2017-02-16 17:16:41 +0000 |
commit | 58d762176a6e2216760bc9b56b40665172b9f6fa (patch) | |
tree | e8af1d0d2a31ca93683b7d70a4f465f1f2efbce1 /src/runtime/sema.go | |
parent | 83f95b85deb97b1f4643362bcd43bee62fd9cc76 (diff) | |
download | go-58d762176a6e2216760bc9b56b40665172b9f6fa.tar.gz go-58d762176a6e2216760bc9b56b40665172b9f6fa.zip |
runtime: run mutexevent profiling without holding semaRoot lock
Suggested by Dmitry in CL 36792 review.
Clearly safe since there are many different semaRoots
that could all have profiled sudogs calling mutexevent.
Change-Id: I45eed47a5be3e513b2dad63b60afcd94800e16d1
Reviewed-on: https://go-review.googlesource.com/37104
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Diffstat (limited to 'src/runtime/sema.go')
-rw-r--r-- | src/runtime/sema.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/runtime/sema.go b/src/runtime/sema.go index 5b9a264ebd..9d4cc3c036 100644 --- a/src/runtime/sema.go +++ b/src/runtime/sema.go @@ -174,13 +174,14 @@ func semrelease(addr *uint32) { s, t0 := root.dequeue(addr) if s != nil { atomic.Xadd(&root.nwait, -1) - if s.acquiretime != 0 { - mutexevent(t0-s.acquiretime, 3) - } } unlock(&root.lock) if s != nil { // May be slow, so unlock first + acquiretime := s.acquiretime readyWithTime(s, 5) + if acquiretime != 0 { + mutexevent(t0-acquiretime, 3) + } } } |