runtime: add eager scavenging details to GODEBUG=scavtrace=1

Also, clean up atomics on released-per-cycle while we're here.

For #57069.

Change-Id: I14026e8281f01dea1e8c8de6aa8944712b7b24d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/495916
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Michael Anthony Knyszek 2023-05-17 16:36:07 +00:00 committed by Michael Knyszek
parent 0bbb54a02d
commit a3e90dc377
5 changed files with 34 additions and 17 deletions

View file

@ -48,6 +48,7 @@
package runtime
import (
"runtime/internal/atomic"
"unsafe"
)
@ -270,10 +271,13 @@ type pageAlloc struct {
// scavenge.
index scavengeIndex
// released is the amount of memory released this scavenge cycle.
//
// Updated atomically.
released uintptr
// releasedBg is the amount of memory released in the background this
// scavenge cycle.
releasedBg atomic.Uintptr
// releasedEager is the amount of memory released eagerly this scavenge
// cycle.
releasedEager atomic.Uintptr
}
// mheap_.lock. This level of indirection makes it possible