aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgc.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2021-04-01 18:38:14 +0000
committerMichael Knyszek <mknyszek@google.com>2021-04-14 14:03:30 +0000
commit3eaf75c13a2e86ff9f9ab8014caa7fc6b855f130 (patch)
treeabf7818886bab73bb0a5618f01298fd136a6b315 /src/runtime/mgc.go
parente224787fef3227587aceddbe21a792e3102d3cfb (diff)
downloadgo-3eaf75c13a2e86ff9f9ab8014caa7fc6b855f130.tar.gz
go-3eaf75c13a2e86ff9f9ab8014caa7fc6b855f130.zip
runtime: move next_gc and last_next_gc into gcControllerState
This change moves next_gc and last_next_gc into gcControllerState under the names heapGoal and lastHeapGoal respectively. These are fundamentally GC pacer related values, and so it makes sense for them to live here. Partially generated by rf ' ex . { memstats.next_gc -> gcController.heapGoal memstats.last_next_gc -> gcController.lastHeapGoal } ' except for updates to comments and gcControllerState methods, where they're accessed through the receiver, and trace-related renames of NextGC -> HeapGoal, while we're here. For #44167. Change-Id: I1e871ad78a57b01be8d9f71bd662530c84853bed Reviewed-on: https://go-review.googlesource.com/c/go/+/306603 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/mgc.go')
-rw-r--r--src/runtime/mgc.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
index e68e9bb75b..bb98cf29bc 100644
--- a/src/runtime/mgc.go
+++ b/src/runtime/mgc.go
@@ -113,8 +113,8 @@
// Next GC is after we've allocated an extra amount of memory proportional to
// the amount already in use. The proportion is controlled by GOGC environment variable
// (100 by default). If GOGC=100 and we're using 4M, we'll GC again when we get to 8M
-// (this mark is tracked in next_gc variable). This keeps the GC cost in linear
-// proportion to the allocation cost. Adjusting GOGC just changes the linear constant
+// (this mark is tracked in gcController.heapGoal variable). This keeps the GC cost in
+// linear proportion to the allocation cost. Adjusting GOGC just changes the linear constant
// (and also the amount of extra memory used).
// Oblets
@@ -669,7 +669,7 @@ func gcStart(trigger gcTrigger) {
work.cycles++
gcController.startCycle()
- work.heapGoal = memstats.next_gc
+ work.heapGoal = gcController.heapGoal
// In STW mode, disable scheduling of user Gs. This may also
// disable scheduling of this goroutine, so it may block as
@@ -972,8 +972,8 @@ func gcMarkTermination(nextTriggerRatio float64) {
throw("gc done but gcphase != _GCoff")
}
- // Record next_gc and heap_inuse for scavenger.
- memstats.last_next_gc = memstats.next_gc
+ // Record heapGoal and heap_inuse for scavenger.
+ gcController.lastHeapGoal = gcController.heapGoal
memstats.last_heap_inuse = memstats.heap_inuse
// Update GC trigger and pacing for the next cycle.