-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8296419: [REDO] JDK-8295319: pending_cards_at_gc_start doesn't include cards in thread buffers #11053
Conversation
…sn't include cards in thread buffers" This reverts commit b847fb6.
👋 Welcome back kbarrett! A progress list of the required criteria for merging this PR into |
@kimbarrett 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 /label pull request command. |
Webrevs
|
// Flush early, so later phases don't need to account for per-thread stuff. | ||
// Flushes deferred card marks, so must precede concatenting logs. | ||
retire_tlabs(); | ||
|
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 was wondering whether we should do something about all the methods (retire_tlabs
, concatenate_dirty_card_logs...
, calculate_collection_set
) methods here that are part of the pre_evacuate_collection_set
phase but are now located outside of that method.
Looking at the per_thread_states
parameter passed to pre_evacuate_collection_set
, it's only used for some verification inside pre_evacuate_collection_set
, i.e. we could move that verification and initialization of the PSSS :) afterpre_evacuate_collection_set
instead.
Since the change touches that code, I think it is appropriate (and better) to consolidate right away.
I agree about that deferring combining and parallelizing the various phases of pre_evacuate_collection_set
can be done extra; the reason why we want parallelization of the TLAB retiring is that there can be tens of thousands threads, and even little work per thread adds up (there is a CR for that already actually, JDK-8211104).
Other than that it looks good to me.
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 made a prototype for this suggestion: 587660c that seems to at least compile. No testing. One may also move rdcqs
and preserved_marks_set
completely into the G1ParScanThreadStateSet
as neither is used elsewhere.
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 also added that suggested refactoring here: https://github.com/openjdk/jdk/compare/pr/11053...tschatzl:jdk:pull/11053-suggestion?expand=1
I've made some adjustments based on @tschatzl suggestion. (The suggestion didn't work as-is, but it was in the right direction, and just needed a bit of cleaning up.) |
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.
Lgtm, and thanks for the changes.
Apologies for introducing a few bugs in my suggestion.
@@ -501,13 +501,22 @@ void G1YoungCollector::verify_empty_dirty_card_logs() const { | |||
} | |||
#endif // ASSERT | |||
|
|||
void G1YoungCollector::pre_evacuate_collection_set(G1EvacInfo* evacuation_info, G1ParScanThreadStateSet* per_thread_states) { | |||
void G1YoungCollector::pre_evacuate_collection_set(G1EvacInfo* evacuation_info) { | |||
// Flush early, so later phases don't need to account for per-thread stuff. |
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 one is duplicate from the comment to concatenate_dirty_card_logs
.
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 was intentional, as it's useful to deal with TLABs early for the same reason as the DCQs. The 2nd line of the comment is about the respective ordering of these two early "flushes". (The plan of merging these into a single pass over the threads will render the duplicate comment question moot.)
@kimbarrett 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 no new commits pushed to the ➡️ To integrate this PR with the above commit message 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.
Looks good.
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.
One more typo to fix before pushing.
|
||
void G1YoungCollector::pre_evacuate_collection_set(G1EvacInfo* evacuation_info) { | ||
// Flush early, so later phases don't need to account for per-thread stuff. | ||
// Flushes deferred card marks, so must precede concatenting logs. |
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.
// Flushes deferred card marks, so must precede concatenting logs. | |
// Flushes deferred card marks, so must precede concatenating logs. |
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. Thanks.
/integrate |
Going to push as commit 1fb9dad. |
@kimbarrett Pushed as commit 1fb9dad. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Let's try this again. This is the original JDK-8295319 change, plus a couple
of small additions to fix problems with that original change.
The description of the original change was:
Please review this change to G1 to include the per-thread buffers in the
number of pending cards at the start of a young GC.
DCQS::concatenate_logs has been renamed to concatenate_logs_and_stats, and now
also merges the per-thread refinement stats during the thread walk to flush
buffers. That replaces the separate thread walk to merge and record these
stats earlier in the GC. The merged stats and related info don't seem to be
needed until after the buffer flushing.
Also, when abandoning dirty card buffers and stats because of a full GC, fixed
to also abandon any buffers in the paused buffers lists.
The problem was that by moving log concatenation earlier, it no longer
followed the call to retire_tlabs(). Among other things, that function
calls flush_deferred_card_mark_barrier() on each thread, possibly adding cards
to the thread's dirty card queue. Doing that after the log concatenation may
lead to unprocessed cards in thread queues, with chaos ensuing.
To fix this, the call to retire_tlabs has also been moved, so that it once
again precedes the log concatenation. Also added (debug-only) verification
that all thread dirty card queues are empty at the end of
pre_evacuate_collection_set.
A possible followup is to refactor those two operations, which each do a
(single-threaded) walk of all threads. We could combine that into a single
walk. We could also parallelize it if that seems warranted, though the
per-thread work is usually pretty small, so might not be worth parallelizing.
There might be an opportunity to do some similar refactoring for fullgc and
log abandonment, though there the two operations are done far away from each
other.
Testing:
mach5 tier1-6
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11053/head:pull/11053
$ git checkout pull/11053
Update a local copy of the PR:
$ git checkout pull/11053
$ git pull https://git.openjdk.org/jdk pull/11053/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 11053
View PR using the GUI difftool:
$ git pr show -t 11053
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11053.diff