]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: clean up remaining mark work check
authorAustin Clements <austin@google.com>
Thu, 16 Aug 2018 16:17:32 +0000 (12:17 -0400)
committerAustin Clements <austin@google.com>
Tue, 2 Oct 2018 20:35:32 +0000 (20:35 +0000)
Now that STW GC marking is unified with concurrent marking, there
should never be mark work remaining in mark termination. Hence, we can
make that check unconditional.

Updates #26903. This is a follow-up to unifying STW GC and concurrent GC.

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

index 0bdff3d657c28bd1b62ea5411643a96f69ead0ca..b390d031ce87d158574a786ec6ed9af1b42b7b5f 100644 (file)
@@ -1905,28 +1905,12 @@ func gcMark(start_time int64) {
        work.nwait = 0
        work.ndone = 0
        work.nproc = uint32(gcprocs())
+       work.helperDrainBlock = false
 
-       if work.full == 0 && work.nDataRoots+work.nBSSRoots+work.nSpanRoots+work.nStackRoots == 0 {
-               // There's no work on the work queue and no root jobs
-               // that can produce work, so don't bother entering the
-               // getfull() barrier. There will be flushCacheRoots
-               // work, but that doesn't gray anything.
-               //
-               // This should always be the situation after
-               // concurrent mark.
-               work.helperDrainBlock = false
-       } else {
-               // There's marking work to do. This is the case during
-               // STW GC. Instruct GC workers
-               // to block in getfull until all GC workers are in getfull.
-               //
-               // TODO(austin): Move STW marking out of
-               // mark termination and eliminate this code path.
-               if debug.gcstoptheworld == 0 {
-                       print("runtime: full=", hex(work.full), " nDataRoots=", work.nDataRoots, " nBSSRoots=", work.nBSSRoots, " nSpanRoots=", work.nSpanRoots, " nStackRoots=", work.nStackRoots, "\n")
-                       panic("non-empty mark queue after concurrent mark")
-               }
-               work.helperDrainBlock = true
+       // Check that there's no marking work remaining.
+       if work.full != 0 || work.nDataRoots+work.nBSSRoots+work.nSpanRoots+work.nStackRoots != 0 {
+               print("runtime: full=", hex(work.full), " nDataRoots=", work.nDataRoots, " nBSSRoots=", work.nBSSRoots, " nSpanRoots=", work.nSpanRoots, " nStackRoots=", work.nStackRoots, "\n")
+               panic("non-empty mark queue after concurrent mark")
        }
 
        if work.nproc > 1 {