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

[GC] Handle growing global_regions_to_decommit lists #106168

Closed
wants to merge 16 commits into from

Conversation

markples
Copy link
Member

@markples markples commented Aug 9, 2024

In some cases, we can add items to the decommit list faster that we're willing to decommit them. Decommit is throttled to avoid potentially long pauses. In these cases, instead of continuing to add items to the decommit list, we can artificially inflate our budgets since the memory is already committed.

One advantage of this fix late in the product cycle is that it only changes behavior if the decommit list is non-empty at the start of a GC. A disadvantage is that capping the new decommit list at the size of the previous amount decommitted is fairly arbitrary and doesn't account for differing times between GCs. We could use different amounts or try to track more history, but also an incorrect amount will just lead to more/less memory on the decommit list until it is recalculated at the next GC anyway.

This also imposes an absolute cap on the decommit list size.

This is an alternate fix to #87715

Copy link
Contributor

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

@markples markples changed the title [GC} Handle growing global_regions_to_decommit lists [GC] Handle growing global_regions_to_decommit lists Aug 9, 2024
markples added a commit to markples/runtime that referenced this pull request Aug 14, 2024
markples added a commit that referenced this pull request Aug 16, 2024
)

In #105521, the number of regions to be decommitted can be reduced, but the budgets weren't updated to include the new regions.  This was fine for huge regions, which just sit in the global free list anyway, and it (sort of) works in release builds (though some regions may end up decommitted anyway if they are still in the surplus list at the end of distribution), but it isn't the intended behavior and can trigger a debug assertion that the surplus list is empty.

This change (a subset of #106168), restructures distribute_free_regions so that instead of "decommit or adjust budgets", we first decommit and adjust the remaining balance.  Then we adjust budgets based on the new value.
@markples markples closed this Sep 27, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant