-
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
8270842: G1: Only young regions need to redirty outside references in remset. #4853
Conversation
👋 Welcome back mli! A progress list of the required criteria for merging this PR into |
@Hamlin-Li 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
|
Instead of trying to optimize this scanning a bit, did you consider avoiding this rescan for all types of regions? It seems that the code for skipping the enqueuing for young region is this:
I.e. just as a thought, would it be worth a try to fake an "old" region by doing
I have not really checked this actually works, but it seems a nice hack to avoid the rescanning if it worked. If it does, the naming of the scoped object |
Thanks for the suggestion, I think it should work, I will update the patch as you suggested. In fact, I have this question in my mind for a while, this is not related to evac failed obj. If an obj A in young region has the ONLY reference to obj B in optional set (but not in current cset), where this refering relationship is recorded after the young is evaced to survirvor regions? I guessed it's recorded by other "dead" old obj, as in remset there is no reference from young to old. |
Please have a look at |
Fwiw, I did not do any performance evaluation of that idea to completely avoid scanning during evacuation failure. I do not think it has significant impact though. |
Sorry for delayed reply, I've been occupied by other things.
diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
template void enqueue_card_if_tracked(G1HeapRegionAttr region_attr, T* p, oop o) {
#ifdef ASSERT After investigation, I think it's because the difference between the initial patch (says pathc I) and the patch hacking G1ScanInYoungSetter (says patch H) is that:
If I amend following patch (says Patch A), it will resolve the crash issue, but I don't think this is what we want.
''' I still don't know the exact reason why the Patch H will fail, not sure if you will have some clue? |
The problem of patch H is that in I experimented a bit how to remove the iteration during self-forwarding pointer removal, one option (not 100% finished, one FIXME and some commented out asserts and the new class isn't as nice as it could be, but it seems to work) is here: https://github.com/tschatzl/jdk/tree/submit/evac-failure-no-scan-during-remove-self-forwards Not sure if I like it, and we would need to test if it actually an improvement (i.e. faster overall - important for region based pinning). So for now the original patch from you seems best to continue with. Initial look at it seems good, but let me push it through our internal testing and re-review it. |
Thanks Thomas, looking forward to hear the further result from you. (I'm sorry for my previous comments, I tried to put patch/diff content in the comment, but seems it's a mess. I start/end patch content with a ''', but seems it does not work as expected.) |
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.
Adding the reason why we need to re-scan only young gen objects is the use of from->is_young()
in various places to avoid enqueuing too many cards. The exact condition would be something like from->is_survivor()
(note: this means the newly allocated survivor regions allocated during this gc - remember that at start of the this gc we relabel all previous survivor regions as eden, which will become part of the eden of the next gc).
I (force-)pushed a prototype that adds such a label to G1HeapRegionAttr
to also avoid touching the HeapRegion
table completely at https://github.com/tschatzl/jdk/tree/submit/evac-failure-no-scan-during-remove-self-forwards.
During this investigation a few additional (unrelated, preexisting) issues with the current handling of objects during evacuation failure became kind of obvious, I filed https://bugs.openjdk.java.net/browse/JDK-8271871 and https://bugs.openjdk.java.net/browse/JDK-8271870.
However I think this change is good as is though and can be replaced later with a more refined version of the suggested prototype.
Testing tier1-5 has also been good afaict (still rerunning as I had some apparently different issues on Windows), as well as running gc/g1 jtreg tests with globally injected -XX:+G1EvacuationFailureALot
(via JAVA_OPTIONS_
).
@Hamlin-Li 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 258 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 |
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 in RemoveSelfForwardPtrObjClosure::do_object()
before the change needs updating. It's completely incomprehensible to me (at this point) and mostly refers to very old behavior. Please change before pushing.
Something like:
// During evacuation failure we do not record inter-region
// references referencing regions that need a remembered set
// update originating from young regions (including eden) that
// failed evacuation. Make up for that omission now by rescanning
// these failed objects.
Thanks Thomas, I've updated the comments. |
Just checked your prototype code, I think it's a good way to go. |
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.
Thanks for your review, Thomas. |
/integrate |
Going to push as commit cc61520.
Your commit was automatically rebased without conflicts. |
@Hamlin-Li Pushed as commit cc61520. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
@Hamlin-Li two reviews are required for hotspot changes. |
@kimbarrett Sorry, I will pay more attention. Thanks for reminding. |
For evac failure objects in non-young regions (old) of cset, the outside reference remset already recorded in the dirty queue, we only needs to do it for obj in young regions
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4853/head:pull/4853
$ git checkout pull/4853
Update a local copy of the PR:
$ git checkout pull/4853
$ git pull https://git.openjdk.java.net/jdk pull/4853/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4853
View PR using the GUI difftool:
$ git pr show -t 4853
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4853.diff