From 143b13ae82d81020dfa6db40818bef5a1f701c3f Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 16 Aug 2018 12:17:32 -0400 Subject: [PATCH] runtime: clean up remaining mark work check 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 TryBot-Result: Gobot Gobot Reviewed-by: Rick Hudson --- src/runtime/mgc.go | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 0bdff3d657..b390d031ce 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -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 {