]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: panic when idling a P with runnable Gs
authorAustin Clements <austin@google.com>
Fri, 24 Apr 2015 20:37:31 +0000 (16:37 -0400)
committerAustin Clements <austin@google.com>
Mon, 27 Apr 2015 12:49:49 +0000 (12:49 +0000)
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 <rlh@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
src/runtime/proc1.go

index a2956fe1adc3dec1bd62d62ab8a9ab5b1c2cadd9..350d6bfbdfd4dc5fe9974cf62a1186ce8620ab8d 100644 (file)
@@ -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