-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Equalize committed space in free regions and move regions to global free list #77597
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
Conversation
…r* of free regions across heaps reasonably well, sometimes the *committed bytes* are distributed very unevenly. This adds a simple algorithm to distribute commit bytes in free regions across heaps. The idea is to exchange regions between heaps with small and large committed bytes in free regions to reduce the difference.
…n allocator and the access to the global free regions list. Rearrange the code in gc_heap::get_free_region to reduce the amount of duplicated code.
… to have both a per heap free list and a global one.
Tagging subscribers to this area: @dotnet/gc Issue DetailsWe observed that while distribute_free_regions distributes the number of free regions across heaps reasonably well, sometimes the committed bytes are distributed very unevenly. This adds a simple algorithm to distribute commit bytes in free regions across heaps. The idea is to exchange regions between heaps with small and large committed bytes in free regions to reduce the difference. As a second step, we move regions above the minimum commit per heap to a global free list. Added code to get_free_region to allocate from this global free list if the per heap free list is empty. To make this thread safe, I'm using a simple spin lock - the first tests indicate no contention at all, so this may be good enough.
|
…ization of min_committed/max_committed local variables was happening in the wrong place - these need to be re-initialized for each iteration.
- Fix race condition - can't verify global free regions outside of the lock - Add more instrumentation. - Sort global free regions at the end of inserting, rather than keeping them sorted while inserting. - Adjust distribute_free_regions to inspect and account for global free regions.
…enhance instrumentation.
…l committed size regions to global free list. Changed nonstandard %Ix and %Id modifiers to %zx and %zd.
…il space in gen 0 as extra_gen0_committed.
Is this PR still relevant? |
This still needs additional instrumentation to verify that it achieves its goals - closing for now. |
We observed that while distribute_free_regions distributes the number of free regions across heaps reasonably well, sometimes the committed bytes are distributed very unevenly.
This adds a simple algorithm to distribute commit bytes in free regions across heaps. The idea is to exchange regions between heaps with small and large committed bytes in free regions to reduce the difference.
As a second step, we move regions above the minimum commit per heap to a global free list. Added code to get_free_region to allocate from this global free list if the per heap free list is empty. To make this thread safe, I'm using a simple spin lock - the first tests indicate no contention at all, so this may be good enough.