Commit 2a46f55b authored by Austin Clements's avatar Austin Clements

runtime: panic when idling a P with runnable Gs

This adds a check that we never put a P on the idle list when it has
work on its local run queue.

Change-Id: Ifcfab750de60c335148a7f513d4eef17be03b6a7
Reviewed-on: https://go-review.googlesource.com/9324Reviewed-by: default avatarRick Hudson <rlh@golang.org>
Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
parent fd5540e7
...@@ -3180,6 +3180,9 @@ func globrunqget(_p_ *p, max int32) *g { ...@@ -3180,6 +3180,9 @@ func globrunqget(_p_ *p, max int32) *g {
// May run during STW, so write barriers are not allowed. // May run during STW, so write barriers are not allowed.
//go:nowritebarrier //go:nowritebarrier
func pidleput(_p_ *p) { func pidleput(_p_ *p) {
if !runqempty(_p_) {
throw("pidleput: P has non-empty run queue")
}
_p_.link = sched.pidle _p_.link = sched.pidle
sched.pidle.set(_p_) sched.pidle.set(_p_)
xadd(&sched.npidle, 1) // TODO: fast atomic xadd(&sched.npidle, 1) // TODO: fast atomic
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment