]> Cypherpunks repositories - gostls13.git/commit
runtime: fix preemption of fractional and idle mark workers
authorAustin Clements <austin@google.com>
Fri, 28 Oct 2016 01:52:51 +0000 (21:52 -0400)
committerAustin Clements <austin@google.com>
Fri, 28 Oct 2016 13:09:48 +0000 (13:09 +0000)
commitdd500193d3e96e6bc9700fd43fc68b55e662d7c1
tree121f5b0179242c54348273941204f76146982673
parentca922b6d363b6ca47822188dcbc5b92d912c7a4b
runtime: fix preemption of fractional and idle mark workers

Currently, gcDrain looks for the preemption flag at getg().preempt.
However, commit d6625ca moved mark worker draining to the system
stack, which means getg() returns the g0, which never has the preempt
flag set, so idle and fractional workers don't get preempted after
10ms and just run until they run out of work. As a result, if there's
enough idle time, GC becomes effectively STW.

Fix this by looking for the preemption flag on getg().m.curg, which
will always be the user G (where the preempt flag is set), regardless
of whether gcDrain is running on the user or the g0 stack.

Change-Id: Ib554cf49a705b86ccc3d08940bc869f868c50dd2
Reviewed-on: https://go-review.googlesource.com/32251
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgcmark.go