]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime: document maxStack and m.createstack in more details
authorAndy Pan <panjf2000@gmail.com>
Thu, 10 Aug 2023 06:02:03 +0000 (14:02 +0800)
committerMichael Knyszek <mknyszek@google.com>
Mon, 21 Aug 2023 17:10:00 +0000 (17:10 +0000)
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>

src/runtime/mprof.go
src/runtime/runtime2.go

index 45f107722aa4ace31d1e40dec6f8365ef9754cc2..937194a238d9b53cc070896c47107dbbf957c781 100644 (file)
@@ -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
 )
 
index 2a02e1fb3bfe2e405133dc68758304688c16dd74..885b493bad3847ae316be3bdb4a3aa27727ebc68 100644 (file)
@@ -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