From e4435cb8448514d2413f9d9aa3ee40738d26fd67 Mon Sep 17 00:00:00 2001 From: Michael Knyszek Date: Wed, 19 Oct 2022 14:51:15 -0400 Subject: runtime: add page tracer This change adds a new GODEBUG flag called pagetrace that writes a low-overhead trace of how pages of memory are managed by the Go runtime. The page tracer is kept behind a GOEXPERIMENT flag due to a potential security risk for setuid binaries. Change-Id: I6f4a2447d02693c25214400846a5d2832ad6e5c0 Reviewed-on: https://go-review.googlesource.com/c/go/+/444157 Reviewed-by: Austin Clements Reviewed-by: David Chase Run-TryBot: Michael Knyszek TryBot-Result: Gopher Robot --- src/runtime/runtime2.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/runtime/runtime2.go') diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index ceb6ff66e2..9381d1e3f7 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -754,6 +754,11 @@ type p struct { // scheduler ASAP (regardless of what G is running on it). preempt bool + // pageTraceBuf is a buffer for writing out page allocation/free/scavenge traces. + // + // Used only if GOEXPERIMENT=pagetrace. + pageTraceBuf pageTraceBuf + // Padding is no longer needed. False sharing is now not a worry because p is large enough // that its size class is an integer multiple of the cache line size (for any of our architectures). } -- cgit v1.3