aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2023-12-13 15:07:28 -0500
committerMichael Pratt <mpratt@google.com>2023-12-15 22:00:45 +0000
commit9b4b3e5acca2dabe107fa2c3ed963097d78a4562 (patch)
treebacab00af0ffbfd2c135e89229f43d3dbbbf3e09 /src/runtime/proc.go
parent793097161b3a263b2b0912265cf99d4d9c6218fa (diff)
downloadgo-9b4b3e5acca2dabe107fa2c3ed963097d78a4562.tar.xz
runtime: properly model rwmutex in lock ranking
Currently, lock ranking doesn't really try to model rwmutex. It records the internal locks rLock and wLock, but in a subpar fashion: 1. wLock is held from lock to unlock, so it works OK, but it conflates write locks of all rwmutexes as rwmutexW, rather than allowing different rwmutexes to have different rankings. 2. rLock is an internal implementation detail that is only taken when there is contention in rlock. As as result, the reader lock path is almost never checked. Add proper modeling. rwmutexR and rwmutexW remain as the ranks of the internal locks, which have their own ordering. The new init method is passed the ranks of the higher level lock that this represents, just like lockInit for mutex. execW ordered before MALLOC captures the case from #64722. i.e., there can be allocation between BeforeFork and AfterFork. For #64722. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-staticlockranking Change-Id: I23335b28faa42fb04f1bc9da02fdf54d1616cd28 Reviewed-on: https://go-review.googlesource.com/c/go/+/549536 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index aae30dc2a8..b9715f267e 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -759,6 +759,8 @@ func schedinit() {
lockInit(&reflectOffs.lock, lockRankReflectOffs)
lockInit(&finlock, lockRankFin)
lockInit(&cpuprof.lock, lockRankCpuprof)
+ allocmLock.init(lockRankAllocmR, lockRankAllocmW)
+ execLock.init(lockRankExecR, lockRankExecW)
traceLockInit()
// Enforce that this lock is always a leaf lock.
// All of this lock's critical sections should be