We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 242adb7 commit 6f7c9eaCopy full SHA for 6f7c9ea
src/runtime/mgc.go
@@ -612,9 +612,6 @@ func gcStart(trigger gcTrigger) {
612
return
613
}
614
615
- // For stats, check if this GC was forced by the user.
616
- work.userForced = trigger.kind == gcTriggerCycle
617
-
618
// In gcstoptheworld debug mode, upgrade the mode accordingly.
619
// We do this after re-checking the transition condition so
620
// that multiple goroutines that detect the heap trigger don't
@@ -630,6 +627,10 @@ func gcStart(trigger gcTrigger) {
630
627
semacquire(&gcsema)
631
628
semacquire(&worldsema)
632
629
+ // 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
633
+
634
if trace.enabled {
635
traceGCStart()
636
0 commit comments