if mode == gcBackgroundMode {
gcBgMarkStartWorkers()
}
+
+ gcResetMarkState()
+
now := nanotime()
work.stwprocs, work.maxprocs = gcprocs(), gomaxprocs
work.tSweepTerm = now
// reclaimed until the next GC cycle.
clearpools()
- gcResetMarkState()
-
work.finalizersDone = false
if mode == gcBackgroundMode { // Do as much work concurrently as possible
}
// 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.