aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2025-11-19 23:42:06 +0000
committerGopher Robot <gobot@golang.org>2025-11-24 13:20:13 -0800
commit7fbd141de506e331ef3f5910b505ece91a012e4a (patch)
treecc4ad79b0f3e0fbbb47f4254c4313c65795a4681 /src/runtime
parent0bc192368ac603614dc3f240e751f539d91a1db2 (diff)
downloadgo-7fbd141de506e331ef3f5910b505ece91a012e4a.tar.xz
runtime: use m.profStack in traceStack
Turns out we spend a few percent of the trace event writing path in just zero-initializing the stack space for pcBuf. We don't need zero initialization, since we're going to write over whatever we actually use. Use m.profStack instead, which is already sized correctly. A side-effect of this change is that trace stacks now obey the GODEBUG profstackdepth where they previously ignored it. The name clearly doesn't match, but this is a positive: there's no reason the maximum stack depth shouldn't apply to every diagnostic. Change-Id: Ia654d3d708f15cbb2e1d95af196ae10b07a65df2 Reviewed-on: https://go-review.googlesource.com/c/go/+/723062 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/tracestack.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/tracestack.go b/src/runtime/tracestack.go
index 0da217fba9..d3f217bbac 100644
--- a/src/runtime/tracestack.go
+++ b/src/runtime/tracestack.go
@@ -30,7 +30,7 @@ const (
//
// Avoid calling this function directly. Prefer traceEventWriter.stack.
func traceStack(skip int, gp *g, tab *traceStackTable) uint64 {
- var pcBuf [tracev2.MaxFramesPerStack]uintptr
+ pcBuf := getg().m.profStack
// Figure out gp and mp for the backtrace.
var mp *m