]> Cypherpunks repositories - gostls13.git/commit
runtime: blame unlocker for mutex delay
authorRhys Hiltner <rhys.hiltner@gmail.com>
Tue, 22 Apr 2025 16:21:30 +0000 (09:21 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 7 May 2025 19:22:14 +0000 (12:22 -0700)
commit4d0f955a5e2a7c3310f15983b643ff5bf5fc1351
tree8314da43e637a4545463ccec0d7b7a008862927c
parentbce8486ebec8b2f62f2305b2a17cc5aec8202507
runtime: blame unlocker for mutex delay

Correct how the mutex contention profile reports on runtime-internal
mutex values, to match sync.Mutex's semantics.

Decide at the start of unlock2 whether we'd like to collect a contention
sample. If so: Opt in to a slightly slower unlock path which avoids
accidentally accepting blame for delay caused by other Ms. Release the
lock before doing an O(N) traversal of the stack of waiting Ms, to
calculate the total delay to those Ms that our critical section caused.
Report that, with the current callstack, in the mutex profile.

Fixes #66999

Change-Id: I561ed8dc120669bd045d514cb0d1c6c99c2add04
Reviewed-on: https://go-review.googlesource.com/c/go/+/667615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/lock_spinbit.go
src/runtime/mprof.go