-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8331572: Allow using OopMapCache outside of STW GC phases #19229
Conversation
/contributor add @zhengyu123 |
👋 Welcome back shade! A progress list of the required criteria for merging this PR into |
@shipilev 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 60 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 |
@shipilev |
eac6783
to
62eda44
Compare
Performance note: there is an intrinsic tradeoff here between the cost of acquiring the critical section vs the concurrency it unblocks for non-STW GCs and the cache improvements on non-GC paths. The critical section overhead is mostly due to the fence in
So, the original reproducer (very stressy, with lots of interpreter frames) improves dramatically (73 -> 6ms) with Shenandoah GC, but run with Serial GC reveals there is a slight regression in GC times (74 -> 79 ms). I have not been able to replicate this regression in larger benchmarks. Anyhow, this very fine-grained regression nearly disappears (74.1 -> 74.3 ms on Serial) if we optimize the other part of this whole path a bit, done as part of this PR: 455687a. This also improves Shenandoah times further (6.1 -> 5.6 ms). |
Webrevs
|
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 looks good but one question for ZGC, does ZGC need an OopMapCache::cleanup_old_entries() ?
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 did have questions (sorry hit approve too soon).
We still call |
Yes. I think the post-GC cleanup is opportunistic after this patch: it is not necessary, since service thread is supposed to catch up with cleanups, but we might still do it after the phases that we know might generate lots of old entries. This is why I left current calls to |
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 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.
This looks safe. You still get some trigger for cleanup, plus the ServiceThread timeout. The timer comment is vague enough to cover this case also.
I would suggest to move |
Right. Surely, it would be better to move it to |
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 reviews! @stefank, I assume you are fine with the way we (lightly) touched ZGC code? |
Yes, ZGC code looks fine. Thanks! |
All right, thank you all. Test re-run passes, so I am integrating. /integrate |
Going to push as commit d999b81.
Your commit was automatically rebased without conflicts. |
As the reproducer in the issue shows, we would also like to use the
OopMapCache
during the concurrent GC phases. Zhengyu mentions there is also a production problem for stack walking that would benefit from lettingOopMapCache
be used without looking at GC at all.This PR unblocks
OopMapCache
uses for everything. Cleanups are nominally done by service thread. But, still appreciating that majority of use cases would be from GCs, we leave the proactive cleanups from the GC ops here as well. It requires the synchronization between readers that might be copying out the entries out of the hashmap and the concurrent reclamation. Handily,GlobalCounter
can be used for that purpose.After this lands, I think we can go over
OopMapCache::compute_one_oop_map
uses and see if they would instead like to use the cachedlookup
to benefit from this cache too. I think those paths are for OSR and deopts, so their performance is unlikely to be critical. This PR already covers the concurrent GC paths well.Additional testing:
hotspot_gc_shenandoah
(10x)all
all
Progress
Issue
Reviewers
Contributors
<zgu@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19229/head:pull/19229
$ git checkout pull/19229
Update a local copy of the PR:
$ git checkout pull/19229
$ git pull https://git.openjdk.org/jdk.git pull/19229/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19229
View PR using the GUI difftool:
$ git pr show -t 19229
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19229.diff
Webrev
Link to Webrev Comment