aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mcache.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2020-07-23 22:16:46 +0000
committerMichael Knyszek <mknyszek@google.com>2020-10-26 17:26:30 +0000
commitcca3d1e5533cb40beb9ef55bbc332b733adcc6ba (patch)
tree9263a547124bcf05af7c019ed18374deffc7f856 /src/runtime/mcache.go
parenta5088e76f108f6470d2a9b3ac56a58ddb9376e4f (diff)
downloadgo-cca3d1e5533cb40beb9ef55bbc332b733adcc6ba.tar.gz
go-cca3d1e5533cb40beb9ef55bbc332b733adcc6ba.zip
runtime: don't flush local_tinyallocs
This change makes local_tinyallocs work like the rest of the malloc stats and doesn't flush local_tinyallocs, instead making that the source-of-truth. Change-Id: I3e6cb5f1b3d086e432ce7d456895511a48e3617a Reviewed-on: https://go-review.googlesource.com/c/go/+/246967 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/mcache.go')
-rw-r--r--src/runtime/mcache.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/runtime/mcache.go b/src/runtime/mcache.go
index 4d2ba6dff0..fe603116a2 100644
--- a/src/runtime/mcache.go
+++ b/src/runtime/mcache.go
@@ -32,9 +32,8 @@ type mcache struct {
// tiny is a heap pointer. Since mcache is in non-GC'd memory,
// we handle it by clearing it in releaseAll during mark
// termination.
- tiny uintptr
- tinyoffset uintptr
- local_tinyallocs uintptr // number of tiny allocs not counted in other stats
+ tiny uintptr
+ tinyoffset uintptr
// The rest is not accessed on every malloc.
@@ -49,6 +48,7 @@ type mcache struct {
// When read with stats from other mcaches and with the world
// stopped, the result will accurately reflect the state of the
// application.
+ local_tinyallocs uintptr // number of tiny allocs not counted in other stats
local_largealloc uintptr // bytes allocated for large objects
local_nlargealloc uintptr // number of large object allocations
local_nsmallalloc [_NumSizeClasses]uintptr // number of allocs for small objects
@@ -151,6 +151,8 @@ func (c *mcache) donate(d *mcache) {
d.local_nsmallfree[i] += c.local_nsmallfree[i]
c.local_nsmallfree[i] = 0
}
+ d.local_tinyallocs += c.local_tinyallocs
+ c.local_tinyallocs = 0
}
// refill acquires a new span of span class spc for c. This span will