diff options
| author | Andy Pan <panjf2000@gmail.com> | 2023-08-10 14:02:03 +0800 |
|---|---|---|
| committer | Michael Knyszek <mknyszek@google.com> | 2023-08-21 17:10:00 +0000 |
| commit | a7c3de705287d56e3bea8a84ed9a56e4102d3f39 (patch) | |
| tree | 48ca7acfbb3090ff46ae0d6544d00b166d3b5c20 /src/runtime | |
| parent | 50f2b7b76481f045649d12d2a26dd36b7cc248a3 (diff) | |
| download | go-a7c3de705287d56e3bea8a84ed9a56e4102d3f39.tar.xz | |
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 <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/mprof.go | 5 | ||||
| -rw-r--r-- | src/runtime/runtime2.go | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/runtime/mprof.go b/src/runtime/mprof.go index 45f107722a..937194a238 100644 --- a/src/runtime/mprof.go +++ b/src/runtime/mprof.go @@ -39,7 +39,10 @@ const ( // size of bucket hash table buckHashSize = 179999 - // max depth of stack to record in bucket + // maxStack is the max depth of stack to record in bucket. + // Note that it's only used internally as a guard against + // wildly out-of-bounds slicing of the PCs that come after + // a bucket struct, and it could increase in the future. maxStack = 32 ) diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 2a02e1fb3b..885b493bad 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -583,7 +583,7 @@ type m struct { alllink *m // on allm schedlink muintptr lockedg guintptr - createstack [32]uintptr // stack that created this thread. + createstack [32]uintptr // stack that created this thread, it's used for StackRecord.Stack0, so it must align with it. lockedExt uint32 // tracking for external LockOSThread lockedInt uint32 // tracking for internal lockOSThread nextwaitm muintptr // next m waiting for lock |
