//go:nosplit
func (m *consistentHeapStats) acquire() *heapStatsDelta {
if pp := getg().m.p.ptr(); pp != nil {
- seq := atomic.Xadd(&pp.statsSeq, 1)
+ seq := pp.statsSeq.Add(1)
if seq%2 == 0 {
// Should have been incremented to odd.
print("runtime: seq=", seq, "\n")
//go:nosplit
func (m *consistentHeapStats) release() {
if pp := getg().m.p.ptr(); pp != nil {
- seq := atomic.Xadd(&pp.statsSeq, 1)
+ seq := pp.statsSeq.Add(1)
if seq%2 != 0 {
// Should have been incremented to even.
print("runtime: seq=", seq, "\n")
for _, p := range allp {
// Spin until there are no more writers.
- for atomic.Load(&p.statsSeq)%2 != 0 {
+ for p.statsSeq.Load()%2 != 0 {
}
}
// statsSeq is a counter indicating whether this P is currently
// writing any stats. Its value is even when not, odd when it is.
- statsSeq uint32
+ statsSeq atomic.Uint32
// Lock for timers. We normally access the timers while running
// on this P, but the scheduler can also do it from a different P.