Skip to content

Commit 7fbd141

Browse files
mknyszekgopherbot
authored andcommitted
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>
1 parent 0bc1923 commit 7fbd141

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/tracestack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const (
3030
//
3131
// Avoid calling this function directly. Prefer traceEventWriter.stack.
3232
func traceStack(skip int, gp *g, tab *traceStackTable) uint64 {
33-
var pcBuf [tracev2.MaxFramesPerStack]uintptr
33+
pcBuf := getg().m.profStack
3434

3535
// Figure out gp and mp for the backtrace.
3636
var mp *m

0 commit comments

Comments
 (0)