Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: proportional sweep is over-aggressive #12040

Closed
aclements opened this issue Aug 5, 2015 · 1 comment
Closed

runtime: proportional sweep is over-aggressive #12040

aclements opened this issue Aug 5, 2015 · 1 comment

Comments

@aclements
Copy link
Member

Commit fc9ca85 fixed a problem where proportional sweep was under-aggressive, but did so by making it somewhat over-aggressive. In particular, the sweep ratio is computed as pages to sweep per heap byte allocated. As of fc9ca85, sweeping is performed before allocating a span by charging for the entire size of the span requested, rather than the number of bytes actually available for allocation from the returned span. That is, if the returned span is 8K, but already has 6K in use, the mutator is charged for 8K of heap allocation even though it can only allocate 2K more from the span. This effect is more amplified by fragmented heaps.

One way to fix this would be to reimburse the mutator for the in-use bytes of the span ultimately returned to it. It's important to do the sweep before the span is allocated to avoid going in to debt, but this means we don't know what span is going to be returned to the mutator, so it's difficult to do the charge correctly up front. However, it's easy to charge the worst case (which is what we do now) and then return some credit.

Alternatively, the sweep ratio could be in different units, such as pages to sweep per page allocated, but I believe this is difficult to calculate at the beginning of concurrent sweep.

@RLH

@aclements aclements added this to the Go1.6Early milestone Aug 5, 2015
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/16515 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants