]> Cypherpunks repositories - gostls13.git/commit
runtime: steal timers from running P's
authorIan Lance Taylor <iant@golang.org>
Mon, 4 May 2020 23:19:16 +0000 (16:19 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 3 Jun 2020 05:33:54 +0000 (05:33 +0000)
commit9b90491e4a1f98a5b431a49cbf9cbefa18adc883
tree7b95fa39a866d7edcb88723f4bda2ec8b26a03f4
parent9bbe89957620ab72c03a7613ffdbd10a97b54bd6
runtime: steal timers from running P's

Previously we did not steal timers from running P's, because that P
should be responsible for running its own timers. However, if the P
is running a CPU-bound G, this can cause measurable delays in running
ready timers. Also, in CL 214185 we avoided taking the timer lock of a P
with no ready timers, which reduces the chances of timer lock contention.

So, if we can't find any ready timers on sleeping P's, try stealing
them from running P's.

Fixes #38860

Change-Id: I0bf1d5dc56258838bdacccbf89493524e23d7fed
Reviewed-on: https://go-review.googlesource.com/c/go/+/232199
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/runtime/proc.go