summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Neal <todd@tneal.org>2015-08-24 19:11:35 -0500
committerTodd Neal <todd@tneal.org>2015-08-25 02:44:11 +0000
commit3efe36d4c46c609b036f3d6eb209788aa71ec57f (patch)
tree67076536c9d454a03a0d9633b2bdd68edc4ca12d
parent24be0997a20ee7b45dde76dee78404ee9cd9cae7 (diff)
downloadgo-git-3efe36d4c46c609b036f3d6eb209788aa71ec57f.tar.gz
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/13877 Reviewed-by: Minux Ma <minux@golang.org>
-rw-r--r--src/runtime/proc1.go2
-rw-r--r--src/runtime/runtime2.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/proc1.go b/src/runtime/proc1.go
index 09cb775f0d..a5708162de 100644
--- a/src/runtime/proc1.go
+++ b/src/runtime/proc1.go
@@ -1538,7 +1538,7 @@ func resetspinning() {
if _g_.m.spinning {
_g_.m.spinning = false
nmspinning = xadd(&sched.nmspinning, -1)
- if nmspinning < 0 {
+ if int32(nmspinning) < 0 {
throw("findrunnable: negative nmspinning")
}
} else {
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 57cd869d88..fbd43d21da 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -429,7 +429,7 @@ type schedt struct {
pidle puintptr // idle p's
npidle uint32
- nmspinning uint32
+ nmspinning uint32 // limited to [0, 2^31-1]
// Global runnable queue.
runqhead guintptr