-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8226416: MonitorUsedDeflationThreshold can cause repeated async deflation requests #1993
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
Conversation
👋 Welcome back dcubed! A progress list of the required criteria for merging this PR into |
@dcubed-ojdk 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. |
Note: I'm testing out stacking patches in Git so there are commits for This is the correct commit for this PR review: af5c3fe |
Webrevs
|
|
Mailing list message from David Holmes on hotspot-runtime-dev: Hi Dan, On 8/01/2021 9:20 am, Daniel D.Daugherty wrote:
I'm not quite sure what you are trying to test out here. All three Cheers, |
I was hoping that each subsequent PR would be baselined on the previous
|
…; fix bad assert tripped by the now working AvgMonitorsPerThreadEstimate option.
…c in monitors_used_above_threshold(); add MonitorUsedDeflationThresholdTest.java.
…st_ceiling from jint to size_t.
…ress_cnt from 'intx' to 'uintx'.
I've updated this fix with similar changes that were requested in the Any takers for a review? Note: At this point, the other two fixes that preceded this one have This fix passed Mach5 Tier[1-3] testing. |
… info about no-progress async monitor deflation cycles and the NoAsyncDeflationProgressMax option.
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.
Hi Dan,
Thanks for the additional explanatory comments. The fix looks good to me.
A couple of comments on the test.
Thanks,
David
_no_progress_cnt >= NoAsyncDeflationProgressMax) { | ||
float remainder = (100.0 - MonitorUsedDeflationThreshold) / 100.0; | ||
size_t new_ceiling = ceiling + (ceiling * remainder) + 1; | ||
size_t old_ceiling = ObjectSynchronizer::in_use_list_ceiling(); |
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 could capture:
size_t old_ceiling = ceiling;
back after line 1157, rather than re-reading it.
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.
return; | ||
} | ||
|
||
Object obj = new Object(); |
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 is a thread-local object, which means the synchronization has no affect, so I think C2 could elide the following sync-block. Using a static field would make it less likely that this can happen.
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.
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 it has to be a static array of Objects since we want a new
ObjectMonitor per recursion.
if (too_many == null) { | ||
throw new RuntimeException("Did not find too_many string in output.\n"); | ||
} |
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 should call output_detail.reportDiagnosticSummary() before throwing the exception. That emulates what OutputAnalyzer.shouldContain would do. (or you could just use shouldContain).
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 added a call to output_detail.reportDiagnosticSummary().
I didn't use OutputAnalyzer.shouldContain() intentionally
because of this output line:
System.out.println("too_many='" + too_many + "'");
which is there for diagnostic purposes.
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.
Manually tested the use of output_detail.reportDiagnosticSummary()
by temporarily setting too_many = null;
before the check. It caused
nice diagnostic output to be printed. I like this technique!
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.
For the record, when the test passes, the output looks like this:
[2021-01-13T16:12:47.673259Z] Gathering output for process 15104
Found beginning of a deflation cycle.
too_many='Too many deflations without progress; bumping in_use_list_ceiling from 36 to 40'
PASSED.
----------System.err:(1/15)----------
STATUS:Passed.
----------rerun:(34/5039)*----------
so there's just a bit of diagnostic output from the test in the passing case.
System.out.println("PASSED."); | ||
return; | ||
} | ||
|
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.
Please add a comment e.g.
`// else we are the exec'd java subprocess, so run the actual test
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.
Added.
@dholmes-ora - Please re-review when you get the chance. I could use a second reviewer... |
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.
A couple of minor comments.
Thanks,
David
@@ -1167,7 +1167,7 @@ static bool monitors_used_above_threshold(MonitorList* list) { | |||
_no_progress_cnt >= NoAsyncDeflationProgressMax) { | |||
float remainder = (100.0 - MonitorUsedDeflationThreshold) / 100.0; | |||
size_t new_ceiling = ceiling + (ceiling * remainder) + 1; | |||
size_t old_ceiling = ObjectSynchronizer::in_use_list_ceiling(); | |||
size_t old_ceiling = ceiling; |
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.
Is that really what you want? ceiling
may have been assigned again at line 1160.
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 misread your comment... Fixing it now...
@@ -45,6 +45,7 @@ | |||
public class MonitorUsedDeflationThresholdTest { | |||
public static final int DELAY_SECS = 10; | |||
public static int inflate_count = 0; | |||
public static Object 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.
Style nit: Object[] 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.
Ahhh.... fixing it.
@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 40 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 |
@dholmes-ora - let's try this again. Still need one more reviewer... |
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,
David
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.
import java.io.FileInputStream; | ||
import java.io.InputStreamReader; | ||
import java.util.regex.Pattern; | ||
*/ |
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 are these imports commented out?
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.
Oops. I should have deleted those.
@dholmes-ora and @coleenp - Thanks for the reviews! I'll integrate |
/integrate |
@dcubed-ojdk Since your change was applied there have been 48 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit be57cf1. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Adding support for a diagnostic option called NoAsyncDeflationProgressMax
with a default value of 3. If we have three async monitor deflation cycles in a
row with zero monitors deflated, then we adjust the in_use_list_ceiling up.
I've locally built and tested this fix on my MBP13 using the
MonitorUsedDeflationThresholdTest.java test that I wrote when this issue
first came up in June of 2019. I will be including this fix in my next Mach5
Tier[1-3] testing batch.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1993/head:pull/1993
$ git checkout pull/1993