aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgcpacer.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2021-04-01 19:12:02 +0000
committerMichael Knyszek <mknyszek@google.com>2021-04-14 14:04:06 +0000
commit7ec7a3cf33930e346e5f53fd41d2601b7c520056 (patch)
tree6e302346d0a201cc042044efd636a790eec0f080 /src/runtime/mgcpacer.go
parente9cc31e736a6a1931ab010a2fda0e5d0ac4e5127 (diff)
downloadgo-7ec7a3cf33930e346e5f53fd41d2601b7c520056.tar.gz
go-7ec7a3cf33930e346e5f53fd41d2601b7c520056.zip
runtime: make gcEffectiveGrowthRatio a method on gcControllerState
For #44167. Change-Id: Ie3cf8d2960c843a782ec85426fa73c279adaed64 Reviewed-on: https://go-review.googlesource.com/c/go/+/306605 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>
Diffstat (limited to 'src/runtime/mgcpacer.go')
-rw-r--r--src/runtime/mgcpacer.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/runtime/mgcpacer.go b/src/runtime/mgcpacer.go
index 6bf3e3f278..9338359de7 100644
--- a/src/runtime/mgcpacer.go
+++ b/src/runtime/mgcpacer.go
@@ -471,7 +471,7 @@ func (c *gcControllerState) endCycle(userForced bool) float64 {
// growth if we had the desired CPU utilization). The
// difference between this estimate and the GOGC-based goal
// heap growth is the error.
- goalGrowthRatio := gcEffectiveGrowthRatio()
+ goalGrowthRatio := c.effectiveGrowthRatio()
actualGrowthRatio := float64(c.heapLive)/float64(c.heapMarked) - 1
assistDuration := nanotime() - c.markStartTime
@@ -779,7 +779,7 @@ func (c *gcControllerState) commit(triggerRatio float64) {
gcPaceScavenger()
}
-// gcEffectiveGrowthRatio returns the current effective heap growth
+// effectiveGrowthRatio returns the current effective heap growth
// ratio (GOGC/100) based on heapMarked from the previous GC and
// heapGoal for the current GC.
//
@@ -788,10 +788,10 @@ func (c *gcControllerState) commit(triggerRatio float64) {
// heapMinimum, this can be higher than gcPercent/100.
//
// mheap_.lock must be held or the world must be stopped.
-func gcEffectiveGrowthRatio() float64 {
+func (c *gcControllerState) effectiveGrowthRatio() float64 {
assertWorldStoppedOrLockHeld(&mheap_.lock)
- egogc := float64(atomic.Load64(&gcController.heapGoal)-gcController.heapMarked) / float64(gcController.heapMarked)
+ egogc := float64(atomic.Load64(&c.heapGoal)-c.heapMarked) / float64(c.heapMarked)
if egogc < 0 {
// Shouldn't happen, but just in case.
egogc = 0