]> Cypherpunks repositories - gostls13.git/commit
runtime: keep P's first timer when in new atomically accessed field
authorIan Lance Taylor <iant@golang.org>
Mon, 13 Jan 2020 20:17:26 +0000 (12:17 -0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 14 Jan 2020 19:54:20 +0000 (19:54 +0000)
commitcfe3cd903f018dec3cb5997d53b1744df4e53909
treee685f5fa8ca0df1bd74b2c2a634a3b70dc276deb
parent71154e061f067a668e7b619d7b3701470b8561be
runtime: keep P's first timer when in new atomically accessed field

This reduces lock contention when only a few P's are running and
checking for whether they need to run timers on the sleeping P's.
Without this change the running P's would get lock contention
while looking at the sleeping P's timers. With this change a single
atomic load suffices to determine whether there are any ready timers.

Change-Id: Ie843782bd56df49867a01ecf19c47498ec827452
Reviewed-on: https://go-review.googlesource.com/c/go/+/214185
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
src/runtime/proc.go
src/runtime/runtime2.go
src/runtime/time.go