Skip to content

Commit

Permalink
runtime: panic when idling a P with runnable Gs
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Dmitry Vyukov <[email protected]>
  • Loading branch information
aclements committed Apr 27, 2015
1 parent fd5540e commit 2a46f55
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/runtime/proc1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a46f55

Please sign in to comment.