aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-04-23 20:00:10 -0400
committerAustin Clements <austin@google.com>2015-04-24 20:10:10 +0000
commitd1cae6358ccf27bc2c864b09aad49fd8a67ac264 (patch)
tree9f937278239d3f4a557ee040dd17f495a067d48c /src
parent26eac917dca240b318685ac019e606d02e79e600 (diff)
downloadgo-d1cae6358ccf27bc2c864b09aad49fd8a67ac264.tar.xz
runtime: fix check for pending GC work
When findRunnable considers running a fractional mark worker, it first checks if there's any work to be done; if there isn't there's no point in running the worker because it will just reschedule immediately. However, currently findRunnable just checks work.full and work.partial, whereas getfull can *also* draw work from m.currentwbuf. As a result, findRunnable may not start a worker even though there actually is work. This problem manifests itself in occasional failures of the test/init1.go test. This test is unusual because it performs a large amount of allocation without executing any write barriers, which means there's nothing to force the pointers in currentwbuf out to the work.partial/full lists where findRunnable can see them. This change fixes this problem by making findRunnable also check for a currentwbuf. This aligns findRunnable with trygetfull's notion of whether or not there's work. Change-Id: Ic76d22b7b5d040bc4f58a6b5975e9217650e66c4 Reviewed-on: https://go-review.googlesource.com/9299 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/mgc.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
index 497c20f0ea..353610d50c 100644
--- a/src/runtime/mgc.go
+++ b/src/runtime/mgc.go
@@ -501,7 +501,7 @@ func (c *gcControllerState) findRunnable(_p_ *p) *g {
// else for a while, so kick everything out of its run
// queue.
} else {
- if work.full == 0 && work.partial == 0 {
+ if _p_.m.ptr().currentwbuf == 0 && work.full == 0 && work.partial == 0 {
// No work to be done right now. This can
// happen at the end of the mark phase when
// there are still assists tapering off. Don't