Description
Recent page allocator changes (#35112) forced changes to scavenger as well. AFAICT these changes came with two problems.
Firstly, the scavenger maintains an address which it uses to mark which part of the address space has already been searched. Unfortunately the updates of this value are racy, and it's difficult to determine what kind of check makes sense to prevent these races. Today these races mean that the scavenger can miss updates and end up not working for a whole GC cycle (since it only runs down the heap once), or it could end up iterating over address space that a partially concurrent scavenge (e.g. from heap-growth) had already looked at. The affect on application performance is a higher average RSS than in Go 1.13.
Secondly, the scavenger is awoken on each "pacing" update, but today that only means an update to the goal. Because the scavenger is now self-paced, this wake-up is mostly errant, and is generally not a good indicator that there's new work to be done. What this means for application performance is that it might be scavenging memory further down the heap than it should (violating some principles of the original scavenge design) and thus causing undue page faults, resulting in worse CPU performance than in Go 1.13.
I suggest that we fix these for Go 1.14 (fixes are already implemented), but they need not block the beta.
Activity
gopherbot commentedon Nov 22, 2019
Change https://golang.org/cl/207998 mentions this issue:
runtime: wake scavenger and update address on sweep done
gopherbot commentedon Nov 22, 2019
Change https://golang.org/cl/208378 mentions this issue:
runtime: remove scavAddr in favor of address ranges
ianlancetaylor commentedon Dec 5, 2019
@mknyszek What is left to do here for 1.14?
mknyszek commentedon Dec 5, 2019
All the patches for this are out for review and I'm iterating on them.
mknyszek commentedon Dec 5, 2019
Sorry, that sounds like they haven't been reviewed yet. By "iterating on them" I mean that they're being iterated on via review passes.
gopherbot commentedon Dec 11, 2019
Change https://golang.org/cl/210877 mentions this issue:
runtime: add scavenge waker goroutine
aclements commentedon Dec 19, 2019
We've decided this seems a bit too high-risk for 1.14 without enough reward. In practice, these races seem quite rare, and if they do happen, they're likely to only delay scavenging by one GC cycle. Bumping to 1.15. If we get evidence that this is causing real memory pressure problems in 1.14, we have the patches ready.
17 remaining items