aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/runtime/mgc.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
index 1c1248936c..20709c0b54 100644
--- a/src/runtime/mgc.go
+++ b/src/runtime/mgc.go
@@ -339,7 +339,7 @@ func gc(mode int) {
})
} else {
// For non-concurrent GC (mode != gcBackgroundMode)
- // g stack have not been scanned so set gcscanvalid
+ // The g stacks have not been scanned so set gcscanvalid
// such that mark termination scans all stacks.
// No races here since we are in a STW phase.
for _, gp := range allgs {
@@ -381,6 +381,14 @@ func gc(mode int) {
if debug.gctrace > 1 {
startTime = nanotime()
+ // The g stacks have been scanned so
+ // they have gcscanvalid==true and gcworkdone==true.
+ // Reset these so that all stacks will be rescanned.
+ // No races here since we are in a STW phase.
+ for _, gp := range allgs {
+ gp.gcworkdone = false // set to true in gcphasework
+ gp.gcscanvalid = false // stack has not been scanned
+ }
finishsweep_m()
gcMark(startTime)
gcSweep(mode)