runtime: fix preemption of fractional and idle mark workers
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 <7ea35d812706d9213868749011af1ed4fa2f6aa0@google.com>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Rick Hudson <838bd060584c511f21c75c69ea04b7b120d86af0@golang.org>

cloudflare/go,vsekhar/elastic-go,akutz/go,suncycheng/go,codestation/go,suncycheng/go,ImJasonH/go,goodlang/good,cloudflare/go,nawawi/go,linux-on-ibm-z/go,Cofyc/go,goodlang/good,josharian/go,Cofyc/go,josharian/go,suncycheng/go,nawawi/go,CAFxX/go,vsekhar/elastic-go,codestation/go,Cofyc/go,cloudflare/go,golang/go,polyverse-security/go,cloudflare/go,goodlang/good,linux-on-ibm-z/go,CAFxX/go,CAFxX/go,derekmarcotte/go,polyverse-security/go,suncycheng/go,goodlang/good,josharian/go,codestation/go,codestation/go,josharian/go,goodlang/good,linux-on-ibm-z/go,polyverse-security/go,Cofyc/go,derekmarcotte/go,ImJasonH/go,Cofyc/go,cloudflare/go,nawawi/go,nawawi/go,josharian/go,nawawi/go,vsekhar/elastic-go,cloudflare/go,derekmarcotte/go,Cofyc/go,codestation/go,codestation/go,vsekhar/elastic-go,CAFxX/go,josharian/go,akutz/go,ImJasonH/go,ImJasonH/go,vsekhar/elastic-go,vsekhar/elastic-go,polyverse-security/go,derekmarcotte/go,Cofyc/go,codestation/go,polyverse-security/go,derekmarcotte/go,suncycheng/go,CAFxX/go,golang/go,CAFxX/go,linux-on-ibm-z/go,vsekhar/elastic-go,akutz/go,polyverse-security/go,ImJasonH/go,CAFxX/go,ImJasonH/go,josharian/go,akutz/go,derekmarcotte/go,linux-on-ibm-z/go,Cofyc/go,golang/go,goodlang/good,golang/go,polyverse-security/go,akutz/go,golang/go,suncycheng/go,polyverse-security/go,codestation/go,goodlang/good,nawawi/go,derekmarcotte/go,cloudflare/go,ImJasonH/go,cloudflare/go,linux-on-ibm-z/go,josharian/go,CAFxX/go,golang/go,akutz/go,derekmarcotte/go,golang/go,linux-on-ibm-z/go,ImJasonH/go,nawawi/go,christopher-henderson/Go,akutz/go,suncycheng/go,suncycheng/go,goodlang/good,golang/go,vsekhar/elastic-go,nawawi/go,linux-on-ibm-z/go,akutz/go