From 6f32d2050d7f0a9d0c529a1a7a21aa8c1d63fa20 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Mon, 25 Oct 2021 21:49:05 +0000 Subject: [PATCH] runtime: pace the scavenger according to 1% of overall CPU time 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 Reviewed-by: Michael Pratt --- src/runtime/mgcscavenge.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/runtime/mgcscavenge.go b/src/runtime/mgcscavenge.go index a2a88e94d2..4a7f2465fd 100644 --- a/src/runtime/mgcscavenge.go +++ b/src/runtime/mgcscavenge.go @@ -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. -- 2.50.0