Commit 3efe36d4 authored by Todd Neal's avatar Todd Neal

runtime: fix nmspinning comparison

nmspinning has a value range of [0, 2^31-1].  Update the comment to
indicate this and fix the comparison so it's not always false.

Fixes #11280

Change-Id: Iedaf0654dcba5e2c800645f26b26a1a781ea1991
Reviewed-on: https://go-review.googlesource.com/13877Reviewed-by: 's avatarMinux Ma <minux@golang.org>
parent 24be0997
...@@ -1538,7 +1538,7 @@ func resetspinning() { ...@@ -1538,7 +1538,7 @@ func resetspinning() {
if _g_.m.spinning { if _g_.m.spinning {
_g_.m.spinning = false _g_.m.spinning = false
nmspinning = xadd(&sched.nmspinning, -1) nmspinning = xadd(&sched.nmspinning, -1)
if nmspinning < 0 { if int32(nmspinning) < 0 {
throw("findrunnable: negative nmspinning") throw("findrunnable: negative nmspinning")
} }
} else { } else {
......
...@@ -429,7 +429,7 @@ type schedt struct { ...@@ -429,7 +429,7 @@ type schedt struct {
pidle puintptr // idle p's pidle puintptr // idle p's
npidle uint32 npidle uint32
nmspinning uint32 nmspinning uint32 // limited to [0, 2^31-1]
// Global runnable queue. // Global runnable queue.
runqhead guintptr runqhead guintptr
......
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