Skip to content

Commit a7c3de7

Browse files
panjf2000mknyszek
authored andcommitted
runtime: document maxStack and m.createstack in more details
Change-Id: If93b6cfa5a598a5f4101c879a0cd88a194e4a6aa Reviewed-on: https://go-review.googlesource.com/c/go/+/518116 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Andy Pan <[email protected]>
1 parent 50f2b7b commit a7c3de7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/runtime/mprof.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ const (
3939
// size of bucket hash table
4040
buckHashSize = 179999
4141

42-
// max depth of stack to record in bucket
42+
// maxStack is the max depth of stack to record in bucket.
43+
// Note that it's only used internally as a guard against
44+
// wildly out-of-bounds slicing of the PCs that come after
45+
// a bucket struct, and it could increase in the future.
4346
maxStack = 32
4447
)
4548

src/runtime/runtime2.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ type m struct {
583583
alllink *m // on allm
584584
schedlink muintptr
585585
lockedg guintptr
586-
createstack [32]uintptr // stack that created this thread.
586+
createstack [32]uintptr // stack that created this thread, it's used for StackRecord.Stack0, so it must align with it.
587587
lockedExt uint32 // tracking for external LockOSThread
588588
lockedInt uint32 // tracking for internal lockOSThread
589589
nextwaitm muintptr // next m waiting for lock

0 commit comments

Comments
 (0)