]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove logical stack sentinel for runtime lock stacks
authorNick Ripley <nick.ripley@datadoghq.com>
Tue, 2 Dec 2025 19:46:39 +0000 (19:46 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 23 Jan 2026 16:26:04 +0000 (08:26 -0800)
When CL 533258 added frame pointer support for the block and mutex
profiles, it deferred skipping/inline expansion, similar to the
execution tracer. The first frame indicated whether this expansion was
needed by holding either the number of frames to skip (implying inline
expansion) or the logicalStackSentinel placeholder to indicate that no
extra handling is needed. However, CL 598515 switched to doing the
skipping/inline expansion at sample time. After this, the sentinel value
is unused. This CL removes the sentinel from runtime lock profiling,
correcting an oversight from that CL. This didn't cause any problems
since post-processing would just ignore the bogus sentinel value; this
is just a cleanup.

Change-Id: Idbec11f57ac7a57426cd8a064782c4fe6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/726040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
src/runtime/mprof.go

index 7d761720b531b63490f9470cab896d460dc9def0..0452b1b605cb74a3e1e1f102ae497de5c56d127a 100644 (file)
@@ -731,8 +731,6 @@ func (prof *mLockProfile) captureStack() {
        }
        prof.haveStack = true
 
-       prof.stack[0] = logicalStackSentinel
-
        var nstk int
        gp := getg()
        sp := sys.GetCallerSP()
@@ -740,7 +738,7 @@ func (prof *mLockProfile) captureStack() {
        systemstack(func() {
                var u unwinder
                u.initAt(pc, sp, 0, gp, unwindSilentErrors|unwindJumpStack)
-               nstk = 1 + tracebackPCs(&u, skip, prof.stack[1:])
+               nstk = tracebackPCs(&u, skip, prof.stack)
        })
        if nstk < len(prof.stack) {
                prof.stack[nstk] = 0
@@ -782,7 +780,6 @@ func (prof *mLockProfile) storeSlow() {
        saveBlockEventStack(cycles, rate, prof.stack[:nstk], mutexProfile)
        if lost > 0 {
                lostStk := [...]uintptr{
-                       logicalStackSentinel,
                        abi.FuncPCABIInternal(_LostContendedRuntimeLock) + sys.PCQuantum,
                }
                saveBlockEventStack(lost, rate, lostStk[:], mutexProfile)