From: Russ Cox Date: Mon, 13 Feb 2017 14:24:05 +0000 (-0500) Subject: runtime: run mutexevent profiling without holding semaRoot lock X-Git-Tag: go1.9beta1~1534 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=58d762176a6e2216760bc9b56b40665172b9f6fa;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor Reviewed-by: Dmitry Vyukov --- 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) + } } }