diff options
author | Russ Cox <rsc@golang.org> | 2017-02-23 15:13:25 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2017-02-27 17:34:28 +0000 |
commit | bae53daa72bf2734acbb648b783752fbd00e357c (patch) | |
tree | f2de542f31b215a425b8f6c83becb8aafa942b08 | |
parent | d4ee1f4a40cecf7511c45c89527f748950f68998 (diff) | |
download | go-bae53daa72bf2734acbb648b783752fbd00e357c.tar.gz go-bae53daa72bf2734acbb648b783752fbd00e357c.zip |
[release-branch.go1.8] runtime: avoid O(n) semaphore list walk in contention profiling
Contention profiling is off by default.
If you turn it on, it has the unfortunate effect of making
the wakeup on a contention mutex go from O(1) to O(n).
Change it back to O(1).
This is already fixed in essentially the same way on master;
master also contains some fixes for the non-profiling code
paths.
Possible for Go 1.8.1.
Change-Id: Iaa644c06e20ca28da4dfa348b7211eedb657e0ba
Reviewed-on: https://go-review.googlesource.com/37341
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
-rw-r--r-- | src/runtime/sema.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/runtime/sema.go b/src/runtime/sema.go index 576a1fb7a2..37318ff9d5 100644 --- a/src/runtime/sema.go +++ b/src/runtime/sema.go @@ -171,6 +171,7 @@ func semrelease(addr *uint32) { for x := root.head; x != nil; x = x.next { if x.elem == unsafe.Pointer(addr) { x.acquiretime = t0 + break } } mutexevent(t0-s.acquiretime, 3) |