aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/mgc.go')
-rw-r--r--src/runtime/mgc.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
index 94301c6dc7..1b95df9cbe 100644
--- a/src/runtime/mgc.go
+++ b/src/runtime/mgc.go
@@ -932,6 +932,9 @@ func gcStart(mode gcMode, forceTrigger bool) {
if mode == gcBackgroundMode {
gcBgMarkStartWorkers()
}
+
+ gcResetMarkState()
+
now := nanotime()
work.stwprocs, work.maxprocs = gcprocs(), gomaxprocs
work.tSweepTerm = now
@@ -949,8 +952,6 @@ func gcStart(mode gcMode, forceTrigger bool) {
// reclaimed until the next GC cycle.
clearpools()
- gcResetMarkState()
-
work.finalizersDone = false
if mode == gcBackgroundMode { // Do as much work concurrently as possible
@@ -1723,8 +1724,10 @@ func gcCopySpans() {
}
// gcResetMarkState resets global state prior to marking (concurrent
-// or STW) and resets the stack scan state of all Gs. Any Gs created
-// after this will also be in the reset state.
+// or STW) and resets the stack scan state of all Gs.
+//
+// This is safe to do without the world stopped because any Gs created
+// during or after this will start out in the reset state.
func gcResetMarkState() {
// This may be called during a concurrent phase, so make sure
// allgs doesn't change.