aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mcache.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2022-04-01 22:34:45 +0000
committerMichael Knyszek <mknyszek@google.com>2022-05-03 15:12:38 +0000
commit375d696ddf102d64729a21f931f4e1d8bfa82ce5 (patch)
tree7a74ef9c84e95daba67d3a3cc1c6545e46e42a74 /src/runtime/mcache.go
parentd36d5bd3c1906d3581ac4ac0d8a1a0eb4b5b16c4 (diff)
downloadgo-375d696ddf102d64729a21f931f4e1d8bfa82ce5.tar.xz
runtime: move inconsistent memstats into gcController
Fundamentally, all of these memstats exist to serve the runtime in managing memory. For the sake of simpler testing, couple these stats more tightly with the GC. This CL was mostly done automatically. The fields had to be moved manually, but the references to the fields were updated via gofmt -w -r 'memstats.<field> -> gcController.<field>' *.go For #48409. Change-Id: Ic036e875c98138d9a11e1c35f8c61b784c376134 Reviewed-on: https://go-review.googlesource.com/c/go/+/397678 Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/mcache.go')
-rw-r--r--src/runtime/mcache.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/mcache.go b/src/runtime/mcache.go
index 4e8ada5bda..5a74431ff4 100644
--- a/src/runtime/mcache.go
+++ b/src/runtime/mcache.go
@@ -171,7 +171,7 @@ func (c *mcache) refill(spc spanClass) {
// Count the allocs in inconsistent, internal stats.
bytesAllocated := int64(slotsUsed * s.elemsize)
- memstats.totalAlloc.Add(bytesAllocated)
+ gcController.totalAlloc.Add(bytesAllocated)
// Update heapLive and flush scanAlloc.
gcController.update(bytesAllocated, int64(c.scanAlloc))
@@ -229,7 +229,7 @@ func (c *mcache) allocLarge(size uintptr, noscan bool) *mspan {
memstats.heapStats.release()
// Count the alloc in inconsistent, internal stats.
- memstats.totalAlloc.Add(int64(npages * pageSize))
+ gcController.totalAlloc.Add(int64(npages * pageSize))
// Update heapLive.
gcController.update(int64(s.npages*pageSize), 0)
@@ -260,7 +260,7 @@ func (c *mcache) releaseAll() {
// Adjust the actual allocs in inconsistent, internal stats.
// We assumed earlier that the full span gets allocated.
- memstats.totalAlloc.Add(int64(slotsUsed * s.elemsize))
+ gcController.totalAlloc.Add(int64(slotsUsed * s.elemsize))
// Release the span to the mcentral.
mheap_.central[i].mcentral.uncacheSpan(s)