From: Austin Clements Date: Fri, 24 Apr 2015 20:37:31 +0000 (-0400) Subject: runtime: panic when idling a P with runnable Gs X-Git-Tag: go1.5beta1~901 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2a46f55b359909ab0710f7952747811dfae07a50;p=gostls13.git 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/9324 Reviewed-by: Rick Hudson Reviewed-by: Dmitry Vyukov --- diff --git a/src/runtime/proc1.go b/src/runtime/proc1.go index a2956fe1ad..350d6bfbdf 100644 --- a/src/runtime/proc1.go +++ b/src/runtime/proc1.go @@ -3180,6 +3180,9 @@ func globrunqget(_p_ *p, max int32) *g { // May run during STW, so write barriers are not allowed. //go:nowritebarrier func pidleput(_p_ *p) { + if !runqempty(_p_) { + throw("pidleput: P has non-empty run queue") + } _p_.link = sched.pidle sched.pidle.set(_p_) xadd(&sched.npidle, 1) // TODO: fast atomic