]> Cypherpunks repositories - gostls13.git/commit
runtime: run background mark helpers only if work is available
authorRick Hudson <rlh@golang.org>
Mon, 18 May 2015 20:02:37 +0000 (16:02 -0400)
committerRick Hudson <rlh@golang.org>
Tue, 19 May 2015 15:57:50 +0000 (15:57 +0000)
commit913db7685ec80bc9c56f357b09ced127fbf09a1e
tree64ffca1e7fefbe8863ad13c21875e6fc1897d27b
parentf4d51eb2f567d12c8b908f9fe3f9650e8a175eb7
runtime: run background mark helpers only if work is available

Prior to this CL whenever the GC marking was enabled and
a P was looking for work we supplied a G to help
the GC do its marking tasks. Once this G finished all
the marking available it would release the P to find another
available G. In the case where there was no work the P would drop
into findrunnable which would execute the mark helper G which would
immediately return and the P would drop into findrunnable again repeating
the process. Since the P was always given a G to run it never blocks.
This CL first checks if the GC mark helper G has available work and if
not the P immediately falls through to its blocking logic.

Fixes #10901

Change-Id: I94ac9646866ba64b7892af358888bc9950de23b5
Reviewed-on: https://go-review.googlesource.com/10189
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/mgc.go
src/runtime/mgcwork.go
src/runtime/proc1.go