Skip to content

Commit 6b4dcf1

Browse files
committed
runtime: hold sched.lock over globrunqputbatch in runqputbatch
globrunqputbatch should never be called without sched.lock held. runqputbatch's documentation even says it may acquire sched.lock in order to call it. Fixes #40457. Change-Id: I5421b64f1da3a6087dfebbef7203db0c95d213a8 Reviewed-on: https://go-review.googlesource.com/c/go/+/245377 Run-TryBot: Michael Knyszek <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Reviewed-by: Cherry Zhang <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 85afa2e commit 6b4dcf1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/runtime/proc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5225,7 +5225,9 @@ func runqputbatch(pp *p, q *gQueue, qsize int) {
52255225

52265226
atomic.StoreRel(&pp.runqtail, t)
52275227
if !q.empty() {
5228+
lock(&sched.lock)
52285229
globrunqputbatch(q, int32(qsize))
5230+
unlock(&sched.lock)
52295231
}
52305232
}
52315233

0 commit comments

Comments
 (0)