aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_debug_test.go
diff options
context:
space:
mode:
authorRhys Hiltner <rhys.hiltner@gmail.com>2024-08-01 11:15:30 -0700
committerGopher Robot <gobot@golang.org>2024-08-01 21:11:15 +0000
commite50913cefcdb590cdf7d9432455de2847ef93851 (patch)
treee3a7143df9e06b61a7a1a0f9043648d7e3b760a5 /src/runtime/export_debug_test.go
parent2caf638e2f8abf3ed765d553164fc3e46e1bf407 (diff)
downloadgo-e50913cefcdb590cdf7d9432455de2847ef93851.tar.xz
runtime: avoid futile mark worker acquisition
During the GC mark phase, one of the first behaviors of findRunnable is to check if it should execute a GC mark worker. Mark workers often run for many milliseconds in a row, so programs that invoke the scheduler more frequently will see that condition trigger only a tiny fraction of the time. Obtaining a mark worker from the gcBgMarkWorkerPool involves a CAS on a single memory location that's shared across the process. When GOMAXPROCS is large, the resulting contention can waste a significant amount of CPU time. But a sufficiently large GOMAXPROCS also means there's no need for fractional mark workers, making it easier to check ahead of time if we need to run a worker. Check, without committing to a particular worker, whether we would even want to run one. For #68399 Change-Id: I5d8578c2101ee20a8a4156a029584356095ea118 Reviewed-on: https://go-review.googlesource.com/c/go/+/602477 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/export_debug_test.go')
0 files changed, 0 insertions, 0 deletions