mirror of
https://github.com/golang/go
synced 2024-11-18 09:24:54 -07:00
runtime: set userForced while holding gcsema
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>
This commit is contained in:
parent
242adb784c
commit
6f7c9ea855
@ -612,9 +612,6 @@ func gcStart(trigger gcTrigger) {
|
||||
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
|
||||
@ -630,6 +627,10 @@ func gcStart(trigger gcTrigger) {
|
||||
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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user