runtime: convert schedt.lastpoll to atomic type

Note that this changes the type from uint64 to int64, the type used by
nanotime(). It also adds an atomic load in pollWork(), which used to use
a non-atomic load.

For #53821.

Change-Id: I6173c90f20bfdc0e0a4bc3a7b1c798d1c429fff5
Reviewed-on: https://go-review.googlesource.com/c/go/+/419442
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Michael Pratt 2022-07-20 17:39:12 -04:00
parent 98e1648823
commit 5d7d50111f
3 changed files with 10 additions and 11 deletions

View file

@ -760,7 +760,7 @@ type p struct {
type schedt struct {
// accessed atomically. keep at top to ensure alignment on 32-bit systems.
goidgen atomic.Uint64
lastpoll uint64 // time of last network poll, 0 if currently polling
lastpoll atomic.Int64 // time of last network poll, 0 if currently polling
pollUntil uint64 // time to which current poll is sleeping
lock mutex