diff options
author | Michael Anthony Knyszek <mknyszek@google.com> | 2020-07-28 20:02:57 +0000 |
---|---|---|
committer | Michael Knyszek <mknyszek@google.com> | 2020-07-30 15:46:39 +0000 |
commit | 6b4dcf19fa493905689dedc27f2232b74c366057 (patch) | |
tree | b15423a2a5ea34c492f8d56a990be32495b51a5a | |
parent | 85afa2eb190d5d1a06584803bde4b4ee9b0e79b0 (diff) | |
download | go-6b4dcf19fa493905689dedc27f2232b74c366057.tar.gz go-6b4dcf19fa493905689dedc27f2232b74c366057.zip |
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 <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
-rw-r--r-- | src/runtime/proc.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index ed1aa1c194..035822216d 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -5225,7 +5225,9 @@ func runqputbatch(pp *p, q *gQueue, qsize int) { atomic.StoreRel(&pp.runqtail, t) if !q.empty() { + lock(&sched.lock) globrunqputbatch(q, int32(qsize)) + unlock(&sched.lock) } } |