runtime: remove ptr/scalar bitmap metric

We don't use this mechanism any more, so the metric will always be zero.
Since CL 616255.

Update #73628

Change-Id: Ic179927a8bc24e6291876c218d88e8848b057c2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/671096
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
khr@golang.org 2025-05-08 10:00:22 -07:00 committed by Gopher Robot
parent e46c8e0558
commit 60d3bcdec3
4 changed files with 16 additions and 26 deletions

View file

@ -28,7 +28,6 @@ var AtomicFields = []uintptr{
unsafe.Offsetof(heapStatsDelta{}.released), unsafe.Offsetof(heapStatsDelta{}.released),
unsafe.Offsetof(heapStatsDelta{}.inHeap), unsafe.Offsetof(heapStatsDelta{}.inHeap),
unsafe.Offsetof(heapStatsDelta{}.inStacks), unsafe.Offsetof(heapStatsDelta{}.inStacks),
unsafe.Offsetof(heapStatsDelta{}.inPtrScalarBits),
unsafe.Offsetof(heapStatsDelta{}.inWorkBufs), unsafe.Offsetof(heapStatsDelta{}.inWorkBufs),
unsafe.Offsetof(lfnode{}.next), unsafe.Offsetof(lfnode{}.next),
unsafe.Offsetof(mstats{}.last_gc_nanotime), unsafe.Offsetof(mstats{}.last_gc_nanotime),

View file

@ -333,8 +333,7 @@ func initMetrics() {
compute: func(in *statAggregate, out *metricValue) { compute: func(in *statAggregate, out *metricValue) {
out.kind = metricKindUint64 out.kind = metricKindUint64
out.scalar = uint64(in.heapStats.committed - in.heapStats.inHeap - out.scalar = uint64(in.heapStats.committed - in.heapStats.inHeap -
in.heapStats.inStacks - in.heapStats.inWorkBufs - in.heapStats.inStacks - in.heapStats.inWorkBufs)
in.heapStats.inPtrScalarBits)
}, },
}, },
"/memory/classes/heap/objects:bytes": { "/memory/classes/heap/objects:bytes": {
@ -397,7 +396,7 @@ func initMetrics() {
deps: makeStatDepSet(heapStatsDep, sysStatsDep), deps: makeStatDepSet(heapStatsDep, sysStatsDep),
compute: func(in *statAggregate, out *metricValue) { compute: func(in *statAggregate, out *metricValue) {
out.kind = metricKindUint64 out.kind = metricKindUint64
out.scalar = uint64(in.heapStats.inWorkBufs+in.heapStats.inPtrScalarBits) + in.sysStats.gcMiscSys out.scalar = uint64(in.heapStats.inWorkBufs) + in.sysStats.gcMiscSys
}, },
}, },
"/memory/classes/os-stacks:bytes": { "/memory/classes/os-stacks:bytes": {

View file

@ -981,7 +981,6 @@ type spanAllocType uint8
const ( const (
spanAllocHeap spanAllocType = iota // heap span spanAllocHeap spanAllocType = iota // heap span
spanAllocStack // stack span spanAllocStack // stack span
spanAllocPtrScalarBits // unrolled GC prog bitmap span
spanAllocWorkBuf // work buf span spanAllocWorkBuf // work buf span
) )
@ -1407,8 +1406,6 @@ HaveSpan:
atomic.Xaddint64(&stats.inHeap, int64(nbytes)) atomic.Xaddint64(&stats.inHeap, int64(nbytes))
case spanAllocStack: case spanAllocStack:
atomic.Xaddint64(&stats.inStacks, int64(nbytes)) atomic.Xaddint64(&stats.inStacks, int64(nbytes))
case spanAllocPtrScalarBits:
atomic.Xaddint64(&stats.inPtrScalarBits, int64(nbytes))
case spanAllocWorkBuf: case spanAllocWorkBuf:
atomic.Xaddint64(&stats.inWorkBufs, int64(nbytes)) atomic.Xaddint64(&stats.inWorkBufs, int64(nbytes))
} }
@ -1719,8 +1716,6 @@ func (h *mheap) freeSpanLocked(s *mspan, typ spanAllocType) {
atomic.Xaddint64(&stats.inHeap, -int64(nbytes)) atomic.Xaddint64(&stats.inHeap, -int64(nbytes))
case spanAllocStack: case spanAllocStack:
atomic.Xaddint64(&stats.inStacks, -int64(nbytes)) atomic.Xaddint64(&stats.inStacks, -int64(nbytes))
case spanAllocPtrScalarBits:
atomic.Xaddint64(&stats.inPtrScalarBits, -int64(nbytes))
case spanAllocWorkBuf: case spanAllocWorkBuf:
atomic.Xaddint64(&stats.inWorkBufs, -int64(nbytes)) atomic.Xaddint64(&stats.inWorkBufs, -int64(nbytes))
} }

View file

@ -442,12 +442,11 @@ func readmemstats_m(stats *MemStats) {
stackInUse := uint64(consStats.inStacks) stackInUse := uint64(consStats.inStacks)
gcWorkBufInUse := uint64(consStats.inWorkBufs) gcWorkBufInUse := uint64(consStats.inWorkBufs)
gcProgPtrScalarBitsInUse := uint64(consStats.inPtrScalarBits)
totalMapped := gcController.heapInUse.load() + gcController.heapFree.load() + gcController.heapReleased.load() + totalMapped := gcController.heapInUse.load() + gcController.heapFree.load() + gcController.heapReleased.load() +
memstats.stacks_sys.load() + memstats.mspan_sys.load() + memstats.mcache_sys.load() + memstats.stacks_sys.load() + memstats.mspan_sys.load() + memstats.mcache_sys.load() +
memstats.buckhash_sys.load() + memstats.gcMiscSys.load() + memstats.other_sys.load() + memstats.buckhash_sys.load() + memstats.gcMiscSys.load() + memstats.other_sys.load() +
stackInUse + gcWorkBufInUse + gcProgPtrScalarBitsInUse stackInUse + gcWorkBufInUse
heapGoal := gcController.heapGoal() heapGoal := gcController.heapGoal()
@ -461,7 +460,7 @@ func readmemstats_m(stats *MemStats) {
// //
// * memstats.heapInUse == inHeap // * memstats.heapInUse == inHeap
// * memstats.heapReleased == released // * memstats.heapReleased == released
// * memstats.heapInUse + memstats.heapFree == committed - inStacks - inWorkBufs - inPtrScalarBits // * memstats.heapInUse + memstats.heapFree == committed - inStacks - inWorkBufs
// * memstats.totalAlloc == totalAlloc // * memstats.totalAlloc == totalAlloc
// * memstats.totalFree == totalFree // * memstats.totalFree == totalFree
// //
@ -482,7 +481,7 @@ func readmemstats_m(stats *MemStats) {
throw("heapReleased and consistent stats are not equal") throw("heapReleased and consistent stats are not equal")
} }
heapRetained := gcController.heapInUse.load() + gcController.heapFree.load() heapRetained := gcController.heapInUse.load() + gcController.heapFree.load()
consRetained := uint64(consStats.committed - consStats.inStacks - consStats.inWorkBufs - consStats.inPtrScalarBits) consRetained := uint64(consStats.committed - consStats.inStacks - consStats.inWorkBufs)
if heapRetained != consRetained { if heapRetained != consRetained {
print("runtime: global value=", heapRetained, "\n") print("runtime: global value=", heapRetained, "\n")
print("runtime: consistent value=", consRetained, "\n") print("runtime: consistent value=", consRetained, "\n")
@ -533,8 +532,8 @@ func readmemstats_m(stats *MemStats) {
// //
// or // or
// //
// HeapSys = sys - stacks_inuse - gcWorkBufInUse - gcProgPtrScalarBitsInUse // HeapSys = sys - stacks_inuse - gcWorkBufInUse
// HeapIdle = sys - stacks_inuse - gcWorkBufInUse - gcProgPtrScalarBitsInUse - heapInUse // HeapIdle = sys - stacks_inuse - gcWorkBufInUse - heapInUse
// //
// => HeapIdle = HeapSys - heapInUse = heapFree + heapReleased // => HeapIdle = HeapSys - heapInUse = heapFree + heapReleased
stats.HeapIdle = gcController.heapFree.load() + gcController.heapReleased.load() stats.HeapIdle = gcController.heapFree.load() + gcController.heapReleased.load()
@ -553,7 +552,7 @@ func readmemstats_m(stats *MemStats) {
// MemStats defines GCSys as an aggregate of all memory related // MemStats defines GCSys as an aggregate of all memory related
// to the memory management system, but we track this memory // to the memory management system, but we track this memory
// at a more granular level in the runtime. // at a more granular level in the runtime.
stats.GCSys = memstats.gcMiscSys.load() + gcWorkBufInUse + gcProgPtrScalarBitsInUse stats.GCSys = memstats.gcMiscSys.load() + gcWorkBufInUse
stats.OtherSys = memstats.other_sys.load() stats.OtherSys = memstats.other_sys.load()
stats.NextGC = heapGoal stats.NextGC = heapGoal
stats.LastGC = memstats.last_gc_unix stats.LastGC = memstats.last_gc_unix
@ -683,7 +682,6 @@ type heapStatsDelta struct {
inHeap int64 // byte delta of memory placed in the heap inHeap int64 // byte delta of memory placed in the heap
inStacks int64 // byte delta of memory reserved for stacks inStacks int64 // byte delta of memory reserved for stacks
inWorkBufs int64 // byte delta of memory reserved for work bufs inWorkBufs int64 // byte delta of memory reserved for work bufs
inPtrScalarBits int64 // byte delta of memory reserved for unrolled GC prog bits
// Allocator stats. // Allocator stats.
// //
@ -709,7 +707,6 @@ func (a *heapStatsDelta) merge(b *heapStatsDelta) {
a.inHeap += b.inHeap a.inHeap += b.inHeap
a.inStacks += b.inStacks a.inStacks += b.inStacks
a.inWorkBufs += b.inWorkBufs a.inWorkBufs += b.inWorkBufs
a.inPtrScalarBits += b.inPtrScalarBits
a.tinyAllocCount += b.tinyAllocCount a.tinyAllocCount += b.tinyAllocCount
a.largeAlloc += b.largeAlloc a.largeAlloc += b.largeAlloc