]> Cypherpunks repositories - gostls13.git/commit
runtime: usleep before stealing runnext only if not in syscall
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 14 Nov 2025 17:41:58 +0000 (17:41 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 14 Nov 2025 23:13:00 +0000 (15:13 -0800)
commitd55ecea9e5a5a4cfba30c6f35d4841ae66e05ccd
treeb4c0d3dba5c11671d8d0958901871e523885fde9
parent410ef44f0054a9ab20a901895edb7db5a4d0aad7
runtime: usleep before stealing runnext only if not in syscall

In the scheduler's steal path, we usleep(3) before stealing a _Prunning
P's runnext slot. Before CL 646198, we would not call usleep(3) if the P
was in _Psyscall. After CL 646198, Ps with Gs in syscalls stay in
_Prunning until stolen, meaning we might unnecessarily usleep(3) where
we didn't before. This probably isn't a huge deal in most cases, but can
cause some apparent slowdowns in microbenchmarks that frequently take
the steal path while there are syscalling goroutines.

Change-Id: I5bf3df10fe61cf8d7f0e9fe9522102de66faf344
Reviewed-on: https://go-review.googlesource.com/c/go/+/720441
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/proc.go