]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime: pass work.userForced to gcController.endCycle explicitly
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 1 Apr 2021 19:09:40 +0000 (19:09 +0000)
committerMichael Knyszek <mknyszek@google.com>
Wed, 14 Apr 2021 14:03:55 +0000 (14:03 +0000)
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>
src/runtime/mgc.go
src/runtime/mgcpacer.go

index bb98cf29bc348a669747c6bec4821d9630f9264c..e4bbf1f016a7b6993d52e358cdd24389b257f129 100644 (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)
index ba16c59052076468bce2a40392af40ac6a918912..6bf3e3f278831e2baf5029e026dd5aae4a33e0d5 100644 (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.