]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: pace the scavenger according to 1% of overall CPU time
authorMichael Anthony Knyszek <mknyszek@google.com>
Mon, 25 Oct 2021 21:49:05 +0000 (21:49 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 5 Nov 2021 17:47:28 +0000 (17:47 +0000)
Currently the scavenger is paced to 1% of 1 CPU because it had
scalability problems. As of the last few CLs, that should be largely
resolved. This change resolves the TODO and paces the scavenger
according to 1% of overall CPU time.

This change is made separately to allow it to be more easily rolled
back.

Change-Id: I1ab4de24ba41c564960701634a128a813c55ece9
Reviewed-on: https://go-review.googlesource.com/c/go/+/358675
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/mgcscavenge.go

index a2a88e94d24b9b0bd8dae958578cc7ed9b7f91fb..4a7f2465fd1d749b9a2803e9b4c2741bf6a60238 100644 (file)
@@ -272,13 +272,7 @@ func bgscavenge(c chan int) {
 
        // idealFraction is the ideal % of overall application CPU time that we
        // spend scavenging.
-       //
-       // TODO(mknyszek): Currently this is percent of one CPU (hence the division
-       // by gomaxprocs), but ideally this should be 1% of overall CPU time.
-       // Given a scalable memory allocator, it makes sense that the scavenger
-       // should scale with it; if you're allocating more frequently, then presumably
-       // you're also generating more work from the scavenger.
-       idealFraction := float64(scavengePercent) / 100.0 / float64(gomaxprocs)
+       idealFraction := float64(scavengePercent) / 100.0
 
        // Input: fraction of CPU time used.
        // Setpoint: idealFraction.