-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8343782: G1: Use one G1CardSet instance for multiple old gen regions #22015
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
|
👋 Welcome back iwalulya! A progress list of the required criteria for merging this PR into |
|
@walulyai This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 18 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
tschatzl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial set of comments.
| // Limit to the number regions in a collection group. We make an exception | ||
| // for the first collection group to be as large as G1Policy::calc_min_old_cset_length | ||
| // because we are certain that these regions have to be collected together. | ||
| static const int GROUP_SIZE = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this a diagnostic flag to allow changing this to (essentially) 1 if needed, i.e. if with a low pause time goal and low amount of worker threads one can select between accuracy of keeping pause time goal and efficiency.
With the current logging we can diagnose such a problem (well, at least consider it, see my comments about logging lacking group information), but we can't give a quick solution.
If the user sets a value of "0" may even mean group sizes of 1 including the first group, but that is not necessary imo (maybe as a way to keep the current test though, but that is not very important because the size of that group can be changed with G1MixedGCCount or similar)
| size_t bytes_to_copy = 0; | ||
| double predicted_eden_time = _policy->predict_young_region_other_time_ms(eden_region_length) + | ||
| _policy->predict_eden_copy_time_ms(eden_region_length); | ||
| _policy->predict_eden_copy_time_ms(eden_region_length, &bytes_to_copy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bytes_to_copy is never used afterwards, so it can be removed (and predict... does not need to get it passed.
| // Retained collection set candidates are aged out, ie. made to regular old regions | ||
| // without remembered sets after a few attempts to save computation costs of keeping | ||
| // them candidates for very long living pinned regions. | ||
| void G1CollectionSet::finalize_old_part(double time_remaining_ms) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above is out of date.
| const uint max_optional_regions = max_old_cset_length - min_old_cset_length; | ||
| uint min_old_cset_length = _policy->calc_min_old_cset_length(candidates()->last_marking_candidates_length()); | ||
| uint max_old_cset_length = MAX2(min_old_cset_length, _policy->calc_max_old_cset_length()); | ||
| uint max_optional_regions = max_old_cset_length - min_old_cset_length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused.
| "Min %u regions, max %u regions, available %u regions" | ||
| "time remaining %1.2fms, optional threshold %1.2fms", | ||
| min_old_cset_length, max_old_cset_length, marking_list->length(), time_remaining_ms, optional_threshold_ms); | ||
| min_old_cset_length, max_old_cset_length, from_marking_groups->num_regions(), time_remaining_ms, optional_threshold_ms); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of these debug messages are regions, it might be useful to add information about groups too. Otherwise it is impossible to understand any grouping issues.
|
|
||
| G1CollectionCandidateListIterator& operator++(); | ||
| G1CollectionSetCandidateInfo* operator*(); | ||
| class G1CSetCandidateGroup : public CHeapObj<mtGCCardSet>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document requirements of regions in group.
src/hotspot/share/gc/g1/g1Policy.cpp
Outdated
| predicted_region_evac_time_ms += predict_region_total_time_ms(ci->_r, false /* for_young_only_phase */); | ||
| min_marking_candidates--; | ||
| predicted_region_evac_time_ms += gr->predict_group_total_time_ms(); | ||
| min_marking_candidates = min_marking_candidates > gr->length() ? (min_marking_candidates - gr->length()) : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this somewhat complex way of saturating subtraction, maybe it is more clear to have an extra counter summing up already added regions and compare that against the (constant) min_marking_candidates.
src/hotspot/share/gc/g1/g1Policy.cpp
Outdated
| } | ||
|
|
||
| double G1Policy::predict_region_merge_scan_time(G1HeapRegion* hr, bool for_young_only_phase) const { | ||
| assert(!hr->is_young(), "Sanity Check!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug code? At least change "Sanity Check" to "must be"; would be nice to at least add region index to the message too.
src/hotspot/share/gc/g1/g1RemSet.cpp
Outdated
|
|
||
| g1h->collection_set()->merge_cardsets_for_collection_groups(g1h, merge, worker_id, _num_workers); | ||
|
|
||
| g1h->collection_set_iterate_increment_from(&combined, nullptr, worker_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is not necessary any more to use the combined closure here. It can be removed afaict, and closure instantiation scoped.
| // Sample card set sizes for humongous before GC: this makes the policy to give | ||
| // back memory to the OS keep the most recent amount of memory for these regions. | ||
| if (hr->is_starts_humongous()) { | ||
| guarantee(!hr->rem_set()->has_group_cardset(), "double adding"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"must be" or "humongous regions should not be grouped/do not have group card sets" would be better. Generally the group card set description does not mention that humongous regions do not use the grouping; obvious in hindsight, but it would be nice to document.
tschatzl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late reply. Some more comments need update, other than that it seems fine.
Co-authored-by: Thomas Schatzl <59967451+tschatzl@users.noreply.github.com>
Co-authored-by: Thomas Schatzl <59967451+tschatzl@users.noreply.github.com>
Co-authored-by: Thomas Schatzl <59967451+tschatzl@users.noreply.github.com>
Co-authored-by: Thomas Schatzl <59967451+tschatzl@users.noreply.github.com>
| product(uint, G1OldCSetGroupSize, 5, EXPERIMENTAL, \ | ||
| "The maximum number of old CSet regions in a collection group. " \ | ||
| "All regions in a group will be evacuated in the same GC pause. The first group calculated after marking from marking candidates " \ | ||
| "may exceed this limit as it is calculated based on G1MixedGCCountTarget.") \ | ||
| range(1, 256) \ | ||
| \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better wrap text to align \.
| #ifdef ASSERT | ||
| uint region_idx = card_region >> config()->log2_card_regions_per_heap_region(); | ||
| G1HeapRegion* r = G1CollectedHeap::heap()->region_at(region_idx); | ||
| assert(r->rem_set()->card_set() != this, "must be"); | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this introduces local vars, can they be grouped in a {} scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible, but I have not seen this done in the hotspot code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a quick search, I can find some in runtime code, though not universal. Regardless, it's better encapsulation, IMO.
| G1CardSet _card_set; | ||
|
|
||
| GrowableArray<G1CollectionSetCandidateInfo> _candidates; | ||
| // |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comment?
| uint num_added_to_group = 0; | ||
| G1CSetCandidateGroup* current = nullptr; | ||
|
|
||
| current = new G1CSetCandidateGroup(G1CollectedHeap::heap()->card_set_config()); | ||
|
|
||
| for (uint i = 0; i < num_infos; i++) { | ||
| G1HeapRegion* r = candidate_infos[i]._r; | ||
| assert(!contains(r), "must not contain region %u", r->hrm_index()); | ||
| _contains_map[r->hrm_index()] = CandidateOrigin::Marking; | ||
|
|
||
| if (num_added_to_group == group_limit) { | ||
| if (group_limit != G1OldCSetGroupSize) { | ||
| group_limit = G1OldCSetGroupSize; | ||
| } | ||
|
|
||
| _from_marking_groups.append(current); | ||
|
|
||
| current = new G1CSetCandidateGroup(G1CollectedHeap::heap()->card_set_config()); | ||
| num_added_to_group = 0; | ||
| } | ||
| current->add(candidate_infos[i]); | ||
| num_added_to_group++; | ||
| } | ||
|
|
||
| _from_marking_groups.append(current); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this part can be written somehow to eliminate some "duplicate" code, so that the following occur only once.
_from_marking_groups.append(current);
current = new G1CSetCandidateGroup(G1CollectedHeap::heap()->card_set_config());
num_added_to_group = 0;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions are welcome, I failed to find a way to handle the corner case.
| void clear(); | ||
|
|
||
| void abandon(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not obvious how the two APIs differ, and which one to use in a certain scenario. Some docs would be nice.
| // in that list must have been pinned for at least G1NumCollectionsKeepPinned | ||
| // GCs and hence are considered "long lived". | ||
| drop_pinned_retained_regions(&pinned_retained_regions); | ||
| uint num_optional_regions = _optional_groups.num_regions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unused.
| G1CSetCandidateGroupList groups_to_abandon; | ||
|
|
||
| for (G1CSetCandidateGroup* group : *retained_groups) { | ||
| assert(group->length() == 1, "Retained groups should have only 1 region"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this property be documented in where _retain_groups is defined, if it is an invariant?
| void iterate(Func&& f) const; | ||
| }; | ||
|
|
||
| // Tracks all collection set candidates, i.e. regions that could/should be evacuated soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems outdated now that fields are group list.
| if (is_young() || is_free()) { | ||
| return -1.0; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why young-regions are treated specially. Also, it's weird that "free" region needs to have a gc-efficiency.
|
|
||
| GrowableArrayFromArray<G1CollectionSetCandidateInfo> a(candidate_infos, (int)num_infos); | ||
| _candidates.appendAll(&a); | ||
| void G1CSetCandidateGroup::add(G1HeapRegion* hr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this method is only for retained regions; if so, one can make that explicit by naming it sth like add_region_region.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Probably add_retained_region was meant here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, we are using the method for adding young regions too
| } | ||
| void G1CSetCandidateGroup::add(G1CollectionSetCandidateInfo& hr_info) { | ||
| G1HeapRegion* hr = hr_info._r; | ||
| assert(!hr->is_young(), "should be flagged as survivor region"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can one assert region is Old here?
| G1CollectionCandidateRegionList other_retained_regions; | ||
| G1CSetCandidateGroupList other_marking_groups; | ||
| G1CSetCandidateGroupList other_retained_groups; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra blank line.
| #include "gc/g1/g1HeapRegionRemSet.hpp" | ||
|
|
||
| template <class CardOrRangeVisitor> | ||
| inline void G1CollectionSet::merge_cardsets_for_collection_groups(G1CollectedHeap* g1h, CardOrRangeVisitor& cl, uint worker_id, uint num_workers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first arg seems unused.
| for (G1CollectionSetCandidateInfo ci : *gr) { | ||
| G1HeapRegion* r = ci._r; | ||
| r->uninstall_group_cardset(); | ||
| r->rem_set()->set_state_complete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why changing the remset state here? I'd expect it's already complete; otherwise, how can it be added to cset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change to assert?
| CodeCache::arm_all_nmethods(); | ||
| } | ||
|
|
||
| void G1CollectedHeap::prepare_group_cardsets_for_scan () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-existing: extra space.
|
|
||
| void G1CSetCandidateGroupList::prepare_for_scan() { | ||
| for (G1CSetCandidateGroup* gr : _groups) { | ||
| gr->card_set()->reset_table_scanner(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a group card set, so why not calling reset_table_scanner_for_groups?
| #ifdef ASSERT | ||
| uint region_idx = card_region >> config()->log2_card_regions_per_heap_region(); | ||
| G1HeapRegion* r = G1CollectedHeap::heap()->region_at(region_idx); | ||
| assert(r->rem_set()->card_set() != this, "must be"); | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a quick search, I can find some in runtime code, though not universal. Regardless, it's better encapsulation, IMO.
| for (G1CollectionSetCandidateInfo ci : *gr) { | ||
| G1HeapRegion* r = ci._r; | ||
| r->uninstall_group_cardset(); | ||
| r->rem_set()->set_state_complete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change to assert?
| size_t _reclaimable_bytes; | ||
| double _gc_efficiency; | ||
|
|
||
| const uint _gid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please comment what this is as gid is not as obvious as the other members. Also not sure if it isn't better to just write out _group_id.
|
|
||
| void abandon(); | ||
| // Delete all groups from the list. The cardset cleanup for regions within the | ||
| // groups could have been done elsewhere (e.g. when adding groups to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // groups could have been done elsewhere (e.g. when adding groups to the | |
| // groups could have been done elsewhere (e.g. when adding groups to the |
| G1CSetCandidateGroupList _from_marking_groups; // Set of regions selected by concurrent marking. | ||
| G1CSetCandidateGroupList _retained_groups; // Set of regions retained due to evacuation failure. | ||
| // Set of regions retained due to evacuation failure. Groups added to this list | ||
| // should contain only one region, making it easier to evacuate retained regions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // should contain only one region, making it easier to evacuate retained regions | |
| // should contain only one region each, making it easier to evacuate retained regions |
| _from_marking_groups.abandon(); | ||
| _retained_groups.clear(true /* uninstall_group_cardset */); | ||
| _from_marking_groups.clear(true /* uninstall_group_cardset */); | ||
| for (uint i = 0; i < _max_regions; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment should not be here but at the gid member. Also, what is a "region default group"?
|
|
||
| GrowableArrayFromArray<G1CollectionSetCandidateInfo> a(candidate_infos, (int)num_infos); | ||
| _candidates.appendAll(&a); | ||
| void G1CSetCandidateGroup::add(G1HeapRegion* hr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Probably add_retained_region was meant here?)
| // The collection set groups to which the region owning this RSet is assigned. | ||
| // We maintain a _default_cset_group to handle special cases, such as humongous regions, | ||
| // which are never added to collection set groups. This approach allows us to avoid using | ||
| // nullptr guards before every use of _cset_group. | ||
| G1CSetCandidateGroup* _default_cset_group; | ||
| G1CSetCandidateGroup* _cset_group; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored to guarantee that all call-sites are aware of this detail, then removed the _default_cset_group.
| // If the region will be collected as part of a group, then we cannot | ||
| // rely on the predition for this region. | ||
| if (_rem_set->is_added_to_cset_group() && _rem_set->cset_group()->length() > 1) { | ||
| return -1.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe all special cases logic (returning -1) in this method belong to the caller, G1PrintRegionLivenessInfoClosure, where we branch use if(gc_eff < 0) {`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed
|
|
||
| struct G1CollectionSetCandidateInfo { | ||
| G1HeapRegion* _r; | ||
| double _gc_efficiency; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that this field has become unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| uint card_within_region; | ||
| split_card(card, card_region, card_within_region); | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra blank line.
| // The set of cards in the Java heap | ||
| G1CardSet* _card_set; | ||
| G1CardSet* _saved_card_set; | ||
| // The collection set groups to which the region owning this RSet is assigned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be singular, "group", right?
|
|
||
| void G1CollectionCandidateList::set(G1CollectionSetCandidateInfo* candidate_infos, uint num_infos) { | ||
| assert(_candidates.is_empty(), "must be"); | ||
| G1CSetCandidateGroup::G1CSetCandidateGroup(G1CardSetConfiguration* config, uint group_id) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT, all callers use the same config from g1heap. I wonder if we reduce arg-list to just group_id.
|
|
||
| uint num_added_to_group = 0; | ||
|
|
||
| uint group_id = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should move this magical constant to where const uint _group_id; is.
| if (r->rem_set()->is_added_to_cset_group()) { | ||
| if (r->rem_set()->cset_group()->length() == 1) { | ||
| gc_eff = r->rem_set()->cset_group()->gc_efficiency(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is gc_eff set only for length == 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the group has more than one region, then the gc_eff is associated with the entire group and not just the single region. However, if we have just one region in the group, then we can go ahead and print the gc_eff details.
| "-", | ||
| size_t(0), young_only_cset_group->card_set()->mem_size()); | ||
|
|
||
| for (G1CSetCandidateGroup* group : g1h->policy()->candidates()->from_marking_groups()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would skip retained groups, right? Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, retained regions are in "single region" groups, so all details should be added to the log when we call do_heap_region
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see; however, this would print the same gc_eff twice if young-gen contains a single region, right? Since this method is about cset-groups, I think it's more natural to visit all groups (regardless their size) here. With this PR, there is no gc_eff associated with individual region, do_heap_region can just skip gc_eff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, creating another issue; now we don't print details on humongous regions. I ask we fix that in a follow up.
|
@walulyai This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
|
Thanks @albertnetymk and @tschatzl for the reviews! /integrate |
|
Going to push as commit 86cec4e.
Your commit was automatically rebased without conflicts. |
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
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22015/head:pull/22015$ git checkout pull/22015Update a local copy of the PR:
$ git checkout pull/22015$ git pull https://git.openjdk.org/jdk.git pull/22015/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22015View PR using the GUI difftool:
$ git pr show -t 22015Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22015.diff
Using Webrev
Link to Webrev Comment