diff options
| author | Ian Lance Taylor <iant@golang.org> | 2020-10-29 16:23:27 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2020-10-30 17:54:57 +0000 |
| commit | e02ab89eb8994fa6f2dfa2924cdadb097633fcc1 (patch) | |
| tree | da5da8d8e31a01b1a6c9beae5ba8b99c98fa7456 /src/runtime/proc.go | |
| parent | a313eec3869c609c0da2402a4cac2d32113d599c (diff) | |
| download | go-e02ab89eb8994fa6f2dfa2924cdadb097633fcc1.tar.xz | |
runtime: simplify nobarrierWakeTime
Also use the simplified nobarrierWakeTime in findrunnable, as it no
longer needs the current time.
Change-Id: I77b125d6a184dde0aeb517fc068164c274f0a046
Reviewed-on: https://go-review.googlesource.com/c/go/+/266304
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/proc.go')
| -rw-r--r-- | src/runtime/proc.go | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index c97f4820da..939757f3a7 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2659,18 +2659,9 @@ stop: // checkTimers here because it calls adjusttimers which may need to allocate // memory, and that isn't allowed when we don't have an active P. for _, _p_ := range allpSnapshot { - // This is similar to nobarrierWakeTime, but minimizes calls to - // nanotime. - if atomic.Load(&_p_.adjustTimers) > 0 { - if now == 0 { - now = nanotime() - } - pollUntil = now - } else { - w := int64(atomic.Load64(&_p_.timer0When)) - if w != 0 && (pollUntil == 0 || w < pollUntil) { - pollUntil = w - } + w := nobarrierWakeTime(_p_) + if w != 0 && (pollUntil == 0 || w < pollUntil) { + pollUntil = w } } if pollUntil != 0 { |
