diff options
| author | Rhys Hiltner <rhys.hiltner@gmail.com> | 2024-05-13 12:23:58 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-05-21 17:17:24 +0000 |
| commit | be0b569caa0eab1a7f30edf64e550bbf5f6ff235 (patch) | |
| tree | 5a64e37f8e0b3314666430823e3fa32d615e31fa /src/runtime/mprof.go | |
| parent | d68d485405d8e604921e6d63ed32ae344fd3049e (diff) | |
| download | go-be0b569caa0eab1a7f30edf64e550bbf5f6ff235.tar.xz | |
runtime: prepare for extensions to waiting M list
Move the nextwaitm field into a small struct, in preparation for
additional metadata to track how long Ms need to wait for locks.
For #66999
Change-Id: Ib40e43c15cde22f7e35922641107973d99439ecd
Reviewed-on: https://go-review.googlesource.com/c/go/+/585635
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/runtime/mprof.go')
| -rw-r--r-- | src/runtime/mprof.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/mprof.go b/src/runtime/mprof.go index b51a1ad3ce..b97fac787e 100644 --- a/src/runtime/mprof.go +++ b/src/runtime/mprof.go @@ -667,6 +667,17 @@ func (lt *lockTimer) end() { } } +// mWaitList is part of the M struct, and holds the list of Ms that are waiting +// for a particular runtime.mutex. +// +// When an M is unable to immediately obtain a lock, it adds itself to the list +// of Ms waiting for the lock. It does that via this struct's next field, +// forming a singly-linked list with the mutex's key field pointing to the head +// of the list. +type mWaitList struct { + next muintptr // next m waiting for lock (set by us, cleared by another during unlock) +} + type mLockProfile struct { waitTime atomic.Int64 // total nanoseconds spent waiting in runtime.lockWithRank stack []uintptr // stack that experienced contention in runtime.lockWithRank |
