RFR: 8343782: G1: Use one G1CardSet instance for multiple old gen regions [v10]
Albert Mingkun Yang
ayang at openjdk.org
Mon Dec 23 10:33:51 UTC 2024
On Thu, 19 Dec 2024 22:26:58 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 29 additional commits since the last revision:
>
> - Merge remote-tracking branch 'upstream/master' into OldGenRemsetGroupsV1
> - Albert review
> - Merge remote-tracking branch 'upstream/master' into OldGenRemsetGroupsV1
> - Merge remote-tracking branch 'upstream/master' into OldGenRemsetGroupsV1
> - fix type
> - fix space issues
> - cleanup
> - assert
> - Thomas Review
> - Merge remote-tracking branch 'upstream/master' into OldGenRemsetGroupsV1
> - ... and 19 more: https://git.openjdk.org/jdk/compare/3927700c...6a8039df
src/hotspot/share/gc/g1/g1CardSet.cpp line 783:
> 781: split_card(card, card_region, card_within_region);
> 782:
> 783:
Extra blank line.
src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp line 40:
> 38: { }
> 39:
> 40: G1CSetCandidateGroup::G1CSetCandidateGroup(G1CardSetConfiguration* config, uint group_id) :
AFAICT, all callers use the same config from g1heap. I wonder if we reduce arg-list to just `group_id`.
src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp line 296:
> 294: uint num_added_to_group = 0;
> 295:
> 296: uint group_id = 2;
Should move this magical constant to where ` const uint _group_id;` is.
src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 3068:
> 3066: if (r->rem_set()->cset_group()->length() == 1) {
> 3067: gc_eff = r->rem_set()->cset_group()->gc_efficiency();
> 3068: }
Why is `gc_eff` set only for length == 1?
src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 3172:
> 3170: size_t(0), young_only_cset_group->card_set()->mem_size());
> 3171:
> 3172: for (G1CSetCandidateGroup* group : g1h->policy()->candidates()->from_marking_groups()) {
This would skip retained groups, right? Is that intentional?
src/hotspot/share/gc/g1/g1HeapRegionRemSet.hpp line 49:
> 47: G1CodeRootSet _code_roots;
> 48:
> 49: // The collection set groups to which the region owning this RSet is assigned.
Should be singular, "group", right?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22015#discussion_r1893739059
PR Review Comment: https://git.openjdk.org/jdk/pull/22015#discussion_r1893774435
PR Review Comment: https://git.openjdk.org/jdk/pull/22015#discussion_r1894518333
PR Review Comment: https://git.openjdk.org/jdk/pull/22015#discussion_r1894520858
PR Review Comment: https://git.openjdk.org/jdk/pull/22015#discussion_r1894521451
PR Review Comment: https://git.openjdk.org/jdk/pull/22015#discussion_r1893739885
More information about the hotspot-gc-dev
mailing list