8252752: Clear card table for old regions during scan in G1#343
8252752: Clear card table for old regions during scan in G1#343tschatzl wants to merge 5 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back tschatzl! A progress list of the required criteria for merging this PR into |
|
@tschatzl The following label will be automatically applied to this pull request: When this pull request is ready to be reviewed, an RFR email will be sent to the corresponding mailing list. If you would like to change these labels, use the |
Webrevs
|
kimbarrett
left a comment
There was a problem hiding this comment.
I found confusing the name may_do_optional_evacuation, used in various
places for local variables, parameter names, and member variables.
"may do" to me suggests "permitted". I think better might be something like
"have_optional_evacuation_regions" or "have_optional_evacuation_work" or
something along those lines.
Other than that naming issue, this looks good.
|
@tschatzl 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 more 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 34 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 |
|
|
||
| // Mark the given range of cards as Scanned. All of these cards must be Dirty. | ||
| inline void mark_as_scanned(size_t start_card_index, size_t num_cards); | ||
| // Mark the given range of cards to "which". All of these cards must be Dirty. |
There was a problem hiding this comment.
Maybe change the comment to "Mark the given range of dirty cards as..." or the function name to "mark_dirty_to"
There was a problem hiding this comment.
I think I fixed that.
| phase_times()->record_or_add_optional_evac_time((Ticks::now() - start).seconds() * 1000.0); | ||
| } | ||
|
|
||
| rem_set()->complete_evac_phase(true /* has_more_than_one_evacuation_phase */); |
There was a problem hiding this comment.
I think it would be cleaner with a local variable:
bool has_more_than_one_evacuation_phase = true;
rem_set()->complete_evac_phase(has_more_than_one_evacuation_phase);
Instead of the comment, same with remember_already_scanned_cards comment above
There was a problem hiding this comment.
I kept it as is as this is the common hotspot style for "documenting" flag parameters, and this suggestion does not seem better to me.
| void evacuate_initial_collection_set(G1ParScanThreadStateSet* per_thread_states); | ||
| // The may_do_optional_evacuation flag indicates whether some or more optional evacuation | ||
| // steps will follow. | ||
| void evacuate_initial_collection_set(G1ParScanThreadStateSet* per_thread_states, |
There was a problem hiding this comment.
The PR description provides a very good motivation for this patch, and I think such motivation should be reprinted here to explain why we are interested in tracking if there is an optional evac.
There was a problem hiding this comment.
I added a little bit of motivation. I am planning to write up more about the card scanning and the various motivations in a better place. I hope the text that is now there is sufficient.
Thanks for your review.
There was a problem hiding this comment.
I hope the text that is now there is sufficient.
Sure; thank you.
|
@albertnetymk, @kimbarrett, @walulyai, thanks for your reviews. Thomas |
| // The may_do_optional_evacuation flag indicates whether some or more optional evacuation | ||
| // steps will follow. | ||
| // The has_optional_evacuation_work flag for the initial collection set | ||
| // evacuation indicates whether some or more optional evacuation steps may |
|
Thanks @kimbarrett @albertnetymk @walulyai for the reviews! /integrate |
|
@tschatzl Since your change was applied there have been 34 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit e9c1782. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi all,
can I get reviews for this change that removes the need for explicit clearing of the card table for typically a large amount of regions in most cases?
Currently g1 unconditionally marks scanned dirty cards as "scanned" to remember that they had already been scanned in earlier evacuation passes. Then in the "clear card table phase" g1 clears all these marks including the card table of evacuated regions.
This change modifies g1 so that if possible, it clears dirty cards after scanning them instead of setting them to "scanned" if there is only one evacuation pass. This saves a lot of work later (e.g. the amount of regions to clear in the clear card table phase may be reduced by a magnitude or more, depending on the ration between evacuated and scanned regions).
The main change here is which type of regions (ones in the collection set, ones that are only scanned) are put into which list of regions g1 already manages: there is one "all" list containing all regions that need clearing, and a "next" list containing the regions to be scanned in the current evacuation pass. Previously g1 put regions into at least one list; now regions in the current collection set are always directly put into the "all" list (as they independently of other reasons require card table cleaning), while to-be-scanned regions are always only put into the "next" list.
Then, to achieve the desired effect that only regions that absolutely require clearing are in the "all" list, g1 does not merge the "next" list into the "all" list when it detects that there will only be one evacuation pass.
Performance impact:
Decreases clear card table time significantly if the number of regions in the collection set is much smaller than the number of scanned regions (as it decreases the number of regions to clear). Some cursory perf testing showed slight overall pause time improvements.
Testing:
hs-tier1-5 ("Initial import" change)
hs-tier1-2 (latest)
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/343/head:pull/343$ git checkout pull/343