runtime: convert schedt.npidle to atomic type

Note that this converts npidle from uint32 to int32 for consistency with
the other count fields in schedt and the type of p.id.

Note that this changes previously unsynchronized operations to
synchronized operations in:
  * handoffp
  * injectglist
  * schedtrace
  * schedEnableUser
  * sync_runtime_canSpin

For #53821.

Change-Id: I36d1b3b4a28131c9d47884fade6bc44439dd6937
Reviewed-on: https://go-review.googlesource.com/c/go/+/419445
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Pratt 2022-07-20 18:01:31 -04:00
parent 449691b3ef
commit 58a1dabfd1
3 changed files with 16 additions and 17 deletions

View file

@ -778,7 +778,7 @@ type schedt struct {
ngsys atomic.Int32 // number of system goroutines
pidle puintptr // idle p's
npidle uint32
npidle atomic.Int32
nmspinning uint32 // See "Worker thread parking/unparking" comment in proc.go.
// Global runnable queue.