Skip to content

Commit 143b13a

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Rick Hudson <[email protected]>
1 parent 1678b2c commit 143b13a

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

Diff for: src/runtime/mgc.go

+5-21
Original file line numberDiff line numberDiff line change
@@ -1905,28 +1905,12 @@ func gcMark(start_time int64) {
19051905
work.nwait = 0
19061906
work.ndone = 0
19071907
work.nproc = uint32(gcprocs())
1908+
work.helperDrainBlock = false
19081909

1909-
if work.full == 0 && work.nDataRoots+work.nBSSRoots+work.nSpanRoots+work.nStackRoots == 0 {
1910-
// There's no work on the work queue and no root jobs
1911-
// that can produce work, so don't bother entering the
1912-
// getfull() barrier. There will be flushCacheRoots
1913-
// work, but that doesn't gray anything.
1914-
//
1915-
// This should always be the situation after
1916-
// concurrent mark.
1917-
work.helperDrainBlock = false
1918-
} else {
1919-
// There's marking work to do. This is the case during
1920-
// STW GC. Instruct GC workers
1921-
// to block in getfull until all GC workers are in getfull.
1922-
//
1923-
// TODO(austin): Move STW marking out of
1924-
// mark termination and eliminate this code path.
1925-
if debug.gcstoptheworld == 0 {
1926-
print("runtime: full=", hex(work.full), " nDataRoots=", work.nDataRoots, " nBSSRoots=", work.nBSSRoots, " nSpanRoots=", work.nSpanRoots, " nStackRoots=", work.nStackRoots, "\n")
1927-
panic("non-empty mark queue after concurrent mark")
1928-
}
1929-
work.helperDrainBlock = true
1910+
// Check that there's no marking work remaining.
1911+
if work.full != 0 || work.nDataRoots+work.nBSSRoots+work.nSpanRoots+work.nStackRoots != 0 {
1912+
print("runtime: full=", hex(work.full), " nDataRoots=", work.nDataRoots, " nBSSRoots=", work.nBSSRoots, " nSpanRoots=", work.nSpanRoots, " nStackRoots=", work.nStackRoots, "\n")
1913+
panic("non-empty mark queue after concurrent mark")
19301914
}
19311915

19321916
if work.nproc > 1 {

0 commit comments

Comments
 (0)