Skip to content

Commit 60d3bcd

Browse files
randall77gopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Auto-Submit: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent e46c8e0 commit 60d3bcd

File tree

4 files changed

+16
-26
lines changed

4 files changed

+16
-26
lines changed

src/runtime/align_runtime_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ var AtomicFields = []uintptr{
2828
unsafe.Offsetof(heapStatsDelta{}.released),
2929
unsafe.Offsetof(heapStatsDelta{}.inHeap),
3030
unsafe.Offsetof(heapStatsDelta{}.inStacks),
31-
unsafe.Offsetof(heapStatsDelta{}.inPtrScalarBits),
3231
unsafe.Offsetof(heapStatsDelta{}.inWorkBufs),
3332
unsafe.Offsetof(lfnode{}.next),
3433
unsafe.Offsetof(mstats{}.last_gc_nanotime),

src/runtime/metrics.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@ func initMetrics() {
333333
compute: func(in *statAggregate, out *metricValue) {
334334
out.kind = metricKindUint64
335335
out.scalar = uint64(in.heapStats.committed - in.heapStats.inHeap -
336-
in.heapStats.inStacks - in.heapStats.inWorkBufs -
337-
in.heapStats.inPtrScalarBits)
336+
in.heapStats.inStacks - in.heapStats.inWorkBufs)
338337
},
339338
},
340339
"/memory/classes/heap/objects:bytes": {
@@ -397,7 +396,7 @@ func initMetrics() {
397396
deps: makeStatDepSet(heapStatsDep, sysStatsDep),
398397
compute: func(in *statAggregate, out *metricValue) {
399398
out.kind = metricKindUint64
400-
out.scalar = uint64(in.heapStats.inWorkBufs+in.heapStats.inPtrScalarBits) + in.sysStats.gcMiscSys
399+
out.scalar = uint64(in.heapStats.inWorkBufs) + in.sysStats.gcMiscSys
401400
},
402401
},
403402
"/memory/classes/os-stacks:bytes": {

src/runtime/mheap.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -979,10 +979,9 @@ func (h *mheap) reclaimChunk(arenas []arenaIdx, pageIdx, n uintptr) uintptr {
979979
type spanAllocType uint8
980980

981981
const (
982-
spanAllocHeap spanAllocType = iota // heap span
983-
spanAllocStack // stack span
984-
spanAllocPtrScalarBits // unrolled GC prog bitmap span
985-
spanAllocWorkBuf // work buf span
982+
spanAllocHeap spanAllocType = iota // heap span
983+
spanAllocStack // stack span
984+
spanAllocWorkBuf // work buf span
986985
)
987986

988987
// manual returns true if the span allocation is manually managed.
@@ -1407,8 +1406,6 @@ HaveSpan:
14071406
atomic.Xaddint64(&stats.inHeap, int64(nbytes))
14081407
case spanAllocStack:
14091408
atomic.Xaddint64(&stats.inStacks, int64(nbytes))
1410-
case spanAllocPtrScalarBits:
1411-
atomic.Xaddint64(&stats.inPtrScalarBits, int64(nbytes))
14121409
case spanAllocWorkBuf:
14131410
atomic.Xaddint64(&stats.inWorkBufs, int64(nbytes))
14141411
}
@@ -1719,8 +1716,6 @@ func (h *mheap) freeSpanLocked(s *mspan, typ spanAllocType) {
17191716
atomic.Xaddint64(&stats.inHeap, -int64(nbytes))
17201717
case spanAllocStack:
17211718
atomic.Xaddint64(&stats.inStacks, -int64(nbytes))
1722-
case spanAllocPtrScalarBits:
1723-
atomic.Xaddint64(&stats.inPtrScalarBits, -int64(nbytes))
17241719
case spanAllocWorkBuf:
17251720
atomic.Xaddint64(&stats.inWorkBufs, -int64(nbytes))
17261721
}

src/runtime/mstats.go

+11-14
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,11 @@ func readmemstats_m(stats *MemStats) {
442442

443443
stackInUse := uint64(consStats.inStacks)
444444
gcWorkBufInUse := uint64(consStats.inWorkBufs)
445-
gcProgPtrScalarBitsInUse := uint64(consStats.inPtrScalarBits)
446445

447446
totalMapped := gcController.heapInUse.load() + gcController.heapFree.load() + gcController.heapReleased.load() +
448447
memstats.stacks_sys.load() + memstats.mspan_sys.load() + memstats.mcache_sys.load() +
449448
memstats.buckhash_sys.load() + memstats.gcMiscSys.load() + memstats.other_sys.load() +
450-
stackInUse + gcWorkBufInUse + gcProgPtrScalarBitsInUse
449+
stackInUse + gcWorkBufInUse
451450

452451
heapGoal := gcController.heapGoal()
453452

@@ -461,7 +460,7 @@ func readmemstats_m(stats *MemStats) {
461460
//
462461
// * memstats.heapInUse == inHeap
463462
// * memstats.heapReleased == released
464-
// * memstats.heapInUse + memstats.heapFree == committed - inStacks - inWorkBufs - inPtrScalarBits
463+
// * memstats.heapInUse + memstats.heapFree == committed - inStacks - inWorkBufs
465464
// * memstats.totalAlloc == totalAlloc
466465
// * memstats.totalFree == totalFree
467466
//
@@ -482,7 +481,7 @@ func readmemstats_m(stats *MemStats) {
482481
throw("heapReleased and consistent stats are not equal")
483482
}
484483
heapRetained := gcController.heapInUse.load() + gcController.heapFree.load()
485-
consRetained := uint64(consStats.committed - consStats.inStacks - consStats.inWorkBufs - consStats.inPtrScalarBits)
484+
consRetained := uint64(consStats.committed - consStats.inStacks - consStats.inWorkBufs)
486485
if heapRetained != consRetained {
487486
print("runtime: global value=", heapRetained, "\n")
488487
print("runtime: consistent value=", consRetained, "\n")
@@ -533,8 +532,8 @@ func readmemstats_m(stats *MemStats) {
533532
//
534533
// or
535534
//
536-
// HeapSys = sys - stacks_inuse - gcWorkBufInUse - gcProgPtrScalarBitsInUse
537-
// HeapIdle = sys - stacks_inuse - gcWorkBufInUse - gcProgPtrScalarBitsInUse - heapInUse
535+
// HeapSys = sys - stacks_inuse - gcWorkBufInUse
536+
// HeapIdle = sys - stacks_inuse - gcWorkBufInUse - heapInUse
538537
//
539538
// => HeapIdle = HeapSys - heapInUse = heapFree + heapReleased
540539
stats.HeapIdle = gcController.heapFree.load() + gcController.heapReleased.load()
@@ -553,7 +552,7 @@ func readmemstats_m(stats *MemStats) {
553552
// MemStats defines GCSys as an aggregate of all memory related
554553
// to the memory management system, but we track this memory
555554
// at a more granular level in the runtime.
556-
stats.GCSys = memstats.gcMiscSys.load() + gcWorkBufInUse + gcProgPtrScalarBitsInUse
555+
stats.GCSys = memstats.gcMiscSys.load() + gcWorkBufInUse
557556
stats.OtherSys = memstats.other_sys.load()
558557
stats.NextGC = heapGoal
559558
stats.LastGC = memstats.last_gc_unix
@@ -678,12 +677,11 @@ func (s *sysMemStat) add(n int64) {
678677
// consistent with one another.
679678
type heapStatsDelta struct {
680679
// Memory stats.
681-
committed int64 // byte delta of memory committed
682-
released int64 // byte delta of released memory generated
683-
inHeap int64 // byte delta of memory placed in the heap
684-
inStacks int64 // byte delta of memory reserved for stacks
685-
inWorkBufs int64 // byte delta of memory reserved for work bufs
686-
inPtrScalarBits int64 // byte delta of memory reserved for unrolled GC prog bits
680+
committed int64 // byte delta of memory committed
681+
released int64 // byte delta of released memory generated
682+
inHeap int64 // byte delta of memory placed in the heap
683+
inStacks int64 // byte delta of memory reserved for stacks
684+
inWorkBufs int64 // byte delta of memory reserved for work bufs
687685

688686
// Allocator stats.
689687
//
@@ -709,7 +707,6 @@ func (a *heapStatsDelta) merge(b *heapStatsDelta) {
709707
a.inHeap += b.inHeap
710708
a.inStacks += b.inStacks
711709
a.inWorkBufs += b.inWorkBufs
712-
a.inPtrScalarBits += b.inPtrScalarBits
713710

714711
a.tinyAllocCount += b.tinyAllocCount
715712
a.largeAlloc += b.largeAlloc

0 commit comments

Comments
 (0)