RFR: 8343782: G1: Use one G1CardSet instance for multiple old gen regions [v8]
Albert Mingkun Yang
ayang at openjdk.org
Tue Dec 17 19:49:40 UTC 2024
On Fri, 13 Dec 2024 12:47:54 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:
>> Hi all,
>>
>> Please review this change to assign multiple collection candidate regions to a single instance of a G1CardSet. Currently, we maintain a 1:1 mapping of old-gen regions and G1CardSet instances, assuming these regions are collected independently. However, regions are collected in batches for performance reasons to meet the G1MixedGCCountTarget.
>>
>> In this change, at the end of the Remark phase, we batch regions that we anticipate will be collected together into a collection group while selecting remembered set rebuild candidates. Regions in a collection group should be evacuated at the same time because they are assigned to the same G1CardSet instances. This implies that we do not need to maintain cross-region remembered set entries for regions within the same collection group.
>>
>> The benefit is a reduction in the memory overhead of the remembered set and the remembered set merge time during the collection pause. One disadvantage is that this approach decreases the flexibility during evacuation: you can only evacuate all regions that share a particular G1CardSet at the same time. Another downside is that pinned regions that are part of a collection group have to be partially evacuated when the collection group is selected for evacuation. This removes the optimization in the mainline implementation where the pinned regions are skipped to allow for potential unpinning before evacuation.
>>
>> In this change, we make significant changes to the collection set implementation as we switch to group selection instead of region selection. Consequently, many of the changes in the PR are about switching from region-centered collection set selection to a group-centered approach.
>>
>> Note: The batching is based on the sort order by reclaimable bytes which may change the evacuation order in which regions would have been evacuated when sorted by gc efficiency.
>>
>> We have not observed any regressions on internal performance testing platforms. Memory comparisons for the Cachestress benchmark for different heap sizes are attached below.
>>
>> Testing: Mach5 Tier1-6
>>
>> 
>> 
>> 
>> 
>
> Ivan Walulya has updated the pull request incrementally with one additional commit since the last revision:
>
> fix space issues
src/hotspot/share/gc/g1/g1CollectionSetCandidates.hpp line 42:
> 40: struct G1CollectionSetCandidateInfo {
> 41: G1HeapRegion* _r;
> 42: double _gc_efficiency;
Seems that this field has become unused.
src/hotspot/share/gc/g1/g1HeapRegion.cpp line 155:
> 153: // rely on the predition for this region.
> 154: if (_rem_set->is_added_to_cset_group() && _rem_set->cset_group()->length() > 1) {
> 155: return -1.0;
I believe all special cases logic (returning -1`) in this method belong to the caller, `G1PrintRegionLivenessInfoClosure`, where we branch use `if(gc_eff < 0) {`.
src/hotspot/share/gc/g1/g1HeapRegionRemSet.hpp line 56:
> 54: // nullptr guards before every use of _cset_group.
> 55: G1CSetCandidateGroup* _default_cset_group;
> 56: G1CSetCandidateGroup* _cset_group;
As I understand it, only one of these two fields contains the real group. I don't get why we need null-checks if only `_cset_group` is there. Whenever we work with `_cset_group`, we should know whether it's null or not already depending on the call-site.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22015#discussion_r1888225888
PR Review Comment: https://git.openjdk.org/jdk/pull/22015#discussion_r1888210762
PR Review Comment: https://git.openjdk.org/jdk/pull/22015#discussion_r1888190793
More information about the hotspot-gc-dev
mailing list