runtime: remove logical stack sentinel for runtime lock stacks

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>
This commit is contained in:
Nick Ripley
2025-12-02 19:46:39 +00:00
committed by Michael Knyszek
parent 23f7ba554d
commit 6b7206feb2

View 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)