Fixes #52515
Change-Id: If10068a97733daf61aba72da5ed3935db8eed8b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/401776
Reviewed-by: hopehook <hopehook@golangcn.org>
Run-TryBot: hopehook <hopehook@golangcn.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
return
}
- // For stats, check if this GC was forced by the user.
- work.userForced = trigger.kind == gcTriggerCycle
-
// In gcstoptheworld debug mode, upgrade the mode accordingly.
// We do this after re-checking the transition condition so
// that multiple goroutines that detect the heap trigger don't
semacquire(&gcsema)
semacquire(&worldsema)
+ // For stats, check if this GC was forced by the user.
+ // Update it under gcsema to avoid gctrace getting wrong values.
+ work.userForced = trigger.kind == gcTriggerCycle
+
if trace.enabled {
traceGCStart()
}