1
0
mirror of https://github.com/golang/go synced 2024-11-22 20:24:47 -07:00

runtime: pass work.userForced to gcController.endCycle explicitly

For #44167.

Change-Id: I15817006f1870d6237cd06dabad988da3f23a6d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/306604
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Anthony Knyszek 2021-04-01 19:09:40 +00:00 committed by Michael Knyszek
parent 3eaf75c13a
commit e9cc31e736
2 changed files with 5 additions and 3 deletions

View File

@ -898,7 +898,7 @@ top:
// endCycle depends on all gcWork cache stats being flushed.
// The termination algorithm above ensured that up to
// allocations since the ragged barrier.
nextTriggerRatio := gcController.endCycle()
nextTriggerRatio := gcController.endCycle(work.userForced)
// Perform mark termination. This will restart the world.
gcMarkTermination(nextTriggerRatio)

View File

@ -444,8 +444,10 @@ func (c *gcControllerState) revise() {
}
// endCycle computes the trigger ratio for the next cycle.
func (c *gcControllerState) endCycle() float64 {
if work.userForced {
// userForced indicates whether the current GC cycle was forced
// by the application.
func (c *gcControllerState) endCycle(userForced bool) float64 {
if userForced {
// Forced GC means this cycle didn't start at the
// trigger, so where it finished isn't good
// information about how to adjust the trigger.