Skip to content

Commit e25ef35

Browse files
committed
runtime: don't disable GC work caching during mark termination
Currently, we disable GC work caching during mark termination. This is no longer necessary with the new mark completion detection because 1. There's no way for any of the GC mark termination helpers to have any real work queued and, 2. Mark termination has to explicitly flush every P's buffers anyway in order to flush Ps that didn't run a GC mark termination helper. Hence, remove the code that disposes gcWork buffers during mark termination. Updates #26903. This is a follow-up to eliminating mark 2. Change-Id: I81f002ee25d5c10f42afd39767774636519007f9 Reviewed-on: https://go-review.googlesource.com/c/134320 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
1 parent d398dbd commit e25ef35

File tree

3 files changed

+0
-12
lines changed

3 files changed

+0
-12
lines changed

src/runtime/mgc.go

-2
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,6 @@ func gcMark(start_time int64) {
19311931
} else {
19321932
gcDrain(gcw, gcDrainNoBlock)
19331933
}
1934-
gcw.dispose()
19351934

19361935
if debug.gccheckmark > 0 {
19371936
// This is expensive when there's a large number of
@@ -2130,7 +2129,6 @@ func gchelper() {
21302129
} else {
21312130
gcDrain(gcw, gcDrainNoBlock)
21322131
}
2133-
gcw.dispose()
21342132
}
21352133

21362134
nproc := atomic.Load(&work.nproc) // work.nproc can change right after we increment work.ndone

src/runtime/mgcmark.go

-5
Original file line numberDiff line numberDiff line change
@@ -1149,11 +1149,6 @@ func shade(b uintptr) {
11491149
if obj, span, objIndex := findObject(b, 0, 0); obj != 0 {
11501150
gcw := &getg().m.p.ptr().gcw
11511151
greyobject(obj, 0, 0, span, gcw, objIndex)
1152-
if gcphase == _GCmarktermination {
1153-
// Ps aren't allowed to cache work during mark
1154-
// termination.
1155-
gcw.dispose()
1156-
}
11571152
}
11581153
}
11591154

src/runtime/mwbbuf.go

-5
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,4 @@ func wbBufFlush1(_p_ *p) {
275275

276276
// Enqueue the greyed objects.
277277
gcw.putBatch(ptrs[:pos])
278-
if gcphase == _GCmarktermination {
279-
// Ps aren't allowed to cache work during mark
280-
// termination.
281-
gcw.dispose()
282-
}
283278
}

0 commit comments

Comments
 (0)