-
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
8291418: adjust monitor deflation logging and deflate_idle_monitors use #11293
Conversation
/label add hotspot-runtime |
👋 Welcome back dcubed! A progress list of the required criteria for merging this PR into |
@dcubed-ojdk |
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 seems reasonable.
Just an observation on the pre-existing logic ... it is interesting that logging has a side-effect of deflating idle monitors. If someone was encountering a problem due to too many inflated monitors and turned on logging to try and show them why, the problem might disappear and the logging would be ineffective in aiding in tracking down the problem.
@dcubed-ojdk 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 53 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.
Looks good.
But this felt not trivial to me :) I tried to understand the preexisting code:
while (ObjectSynchronizer::deflate_idle_monitors(tablep) >= (size_t)MonitorDeflationMax) {
So, was the intent behind this "as long as deflate_idle_monitors() uses its full allotment of deflations, continue, but if you notice it slacking off, stop?" And the assumption is we always deflate n*MonitorDeflationMax + a smaller rest? And this assumption was wrong?
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 to me.
if (deflated_count != 0 || log_is_enabled(Debug, monitorinflation)) { | ||
ls->print_cr("deflated " SIZE_FORMAT " monitors in %3.7f secs", | ||
deflated_count, timer.seconds()); | ||
if (deflated_count != 0 || unlinked_count != 0 || deleted_count != 0 || log_is_enabled(Debug, monitorinflation)) { |
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 check both unlinked_count and deleted_count? Shouldn't they be equal if we got 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.
If memory serves, it's possible for the final safepoint to catch
the MonitorDeflation thread while it's working in here at different
phases of the deflate_idle_monitors()
work. When the VM Thread
comes in here for the "final audit" it can find different amounts of
work to do in the different phases because the MonitorDeflation
thread might have deflated N monitors, but it wasn't able to unlink
them all. When the VM Thread does its pass, it may deflate fewer
monitors (M), but may find N+M monitors need to be unlinked and
deleted.
Similarly, I think it's possible for the MonitorDeflation thread to
deflate N monitors and unlink N monitors, but then block for the
final safepoint. When the VMThread comes along, it may delete
fewer monitors(M) and unlink fewer monitors(M), but may find
N+M monitors need to be deleted. If the VM Thread's M value is
zero, then it will have deflated_count == 0
, unlinked_count == 0
and deleted_count != 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.
But isn't the delete_list local to the MonitorDeflation thread? How can the VMThread access those unlinked but not deleted monitors?
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.
You are right about delete_list
being local so once the
MonitorDeflation thread has successfully unlinked a deflated
ObjectMonitor and put it on the local delete_list
, if the
MonitorDeflation thread goes to a final safepoint, then any
ObjectMonitors on the delete_list won't be freed.
It also means that unlinked_count == deleted_count
in any
thread that reaches L1551. If I change that if-statement, I think
I'd want to add an assert()
there also.
@dholmes-ora, @tstuefe and @pchilano - Thanks for the reviews! Sorry for the delay in getting back to this review. I had an over abundance of |
Thanks!
I suppose that is a possibility if, for some reason, the MonitorDeflation thread was not |
Thanks!
Sorry about that. I suspect that I have lived with this code for too long...
My original intent was "loop here until we have nothing left to deflate". |
Thanks. |
@dholmes-ora, @tstuefe and @pchilano - I think I've replied to all the review comments. Please let me know if |
All good. Thanks for answering my question. |
Added tag jdk-20+26 for changeset c685569
Logging output with the latest commit looks like this:
|
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.
Thanks Dan, latest changes look good.
@pchilano - Thanks for the re-review. |
Local testing of this patch after rebasing to the jdk-20+26 snapshot looks good. /integrate |
Going to push as commit 6065516.
Your commit was automatically rebased without conflicts. |
@dcubed-ojdk Pushed as commit 6065516. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Trivial fixes to monitor deflation logging and deflate_idle_monitors use.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11293/head:pull/11293
$ git checkout pull/11293
Update a local copy of the PR:
$ git checkout pull/11293
$ git pull https://git.openjdk.org/jdk pull/11293/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 11293
View PR using the GUI difftool:
$ git pr show -t 11293
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11293.diff