RFR: 8324649: Shenandoah: refactor implementation of free set [v6]
Kelvin Nilsen
kdnilsen at openjdk.org
Sat Feb 3 15:49:04 UTC 2024
On Sat, 3 Feb 2024 14:38:44 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:
>> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 766:
>>
>>> 764:
>>> 765: // This places regions that have alloc_capacity into the mutator partition.
>>> 766: find_regions_with_alloc_capacity(cset_regions);
>>
>> In conjunction with `clear()` above, it looks like we are doing two walks of the _membership array in the implementation as a result of this. Why not just have a single API from `ShenandoahRegionPartitions` that walks over the regions and sorts them into the NotFree or the Mutator partition in one go, rather than one walk to clear and another to then move some into Mutator?
>>
>> Also the method should probably be renamed to `move_alloc_regions_to_mutator()`, which should be moved into `ShenandoahRegionPartitions` class as a public API for this class `ShenandoahFreeSet` to call.
>
> We walk twice, first to figure out how much memory is available, and how many regions are completely empty. This information eventually feeds into GenShen's transfer of regions between young-gen and old-gen. There is less motivation for that distinction in single-generation Shenandoah because we do not need to make these informed transfers.
But even before genshen changes, there were two walks through the regions. This is because the rebuild wants to "optimize" the organization of the mutator free set and the collector free set. Certain regions that may been in the mutator set during previous GC will be in the collector set during the next gc, and vice versa. We strive to arrange that each free set is "tightly packed" over a subrange of the regions, with collector free set at the high end of memory and mutator set at the lower end of memory. With GenShen integration, we will place the old collector set above the collector set.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17561#discussion_r1477083826
More information about the shenandoah-dev
mailing list