]> Cypherpunks repositories - gostls13.git/commit
runtime: simplify gcBgMarkWorker preemption
authorMichael Pratt <mpratt@google.com>
Tue, 13 Oct 2020 22:11:26 +0000 (18:11 -0400)
committerMichael Pratt <mpratt@google.com>
Fri, 30 Oct 2020 15:26:28 +0000 (15:26 +0000)
commit256d729c0b272021a44f61f47cd2c9c6d9fb1722
tree83ffa52bda5fad6ec9a0b8a8737112fd8b345096
parente1faebe7b40c23811a6025ed104d3ce9882f0c3b
runtime: simplify gcBgMarkWorker preemption

gcBgMarkWorker G's are primarily scheduled by findRunnableGCWorker, but
that no longer needs to be strictly enforced. Temporary preemption to a
runq is fine when the P is not in use.

We still releasem in gopark in the normal case for efficiency: if
gcDrain stops because gp.preempt is set, then gopark would always
preempt. That is fine, but inefficient, since it will reschedule simply
to park again. Thus, we keep releasem in unlockf to skip this extra
cycle.

Change-Id: I6d1a42e3ca41b76227142a6b5bfb376c9213e3c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/262349
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Michael Pratt <mpratt@google.com>
src/runtime/mgc.go