-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8306929: Avoid CleanClassLoaderDataMetaspaces safepoints when previous versions are shared #13716
Conversation
…s versions are shared
👋 Welcome back sjohanss! A progress list of the required criteria for merging this PR into |
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. Thanks for all the testing and adding the new test.
@kstefanj 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 67 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 |
@@ -715,16 +715,16 @@ class InstanceKlass: public Klass { | |||
} | |||
|
|||
private: | |||
static bool _has_previous_versions; | |||
static bool _clean_previous_versions; |
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.
Nit: I'd suggest to name it as _should_clean_previous_versions
.
Then the corresponding function needs to be named as should_clean_previous_versions()
.
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.
Thank you for taking care about it.
I've posted a couple of comments but it it looks good anyway.
Thanks,
Serguei
// classes to be in use. | ||
.shouldNotContain("scratch class added; one of its methods is on_stack.") | ||
.shouldHaveExitValue(0); | ||
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.
The fragments 61-74 and 79-93 have a big common part which can be a good base for a refactoring.
But it can be not worth it. So, I leave it up to you.
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.
Thank you for the update.
Looks good.
Thanks,
Serguei
Going to push as commit 408cec5.
Your commit was automatically rebased without conflicts. |
/backport jdk17u-dev |
@olivergillespie Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u-dev with the title Below you can find a suggestion for the pull request body:
|
Hi all,
Please review this change to avoid CleanClassLoaderDataMetaspaces safepoint when there is nothing that can be cleaned up.
Summary
When transforming/redefining classes a previous version list is linked together in the InstanceKlass. The original class is added to this list if it is still used or shared. The difference between shared and used is not currently noted. This leads to a problem when doing concurrent class unloading, because during that we postpone some potential work to a safepoint (since we are not in one). This is the CleanClassLoaderDataMetaspaces and it is triggered by the ServiceThread if there is work to be done, for example if InstanceKlass::_has_previous_versions is true.
Since we currently does not differentiate between shared and "in use" we always set _has_previous_versions if anything is on this list. This together with the fact that shared previous versions should never be cleaned out leads to this safepoint being triggered after every concurrent class unloading even though there is nothing that can be cleaned out.
This can be avoided by making sure the _previous_versions list is only cleaned when there are non-shared classes on it. This change renames
_has_previous_versions
to_clean_previous_versions
and only updates it if we have non-shared classes on the list.Testing
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13716/head:pull/13716
$ git checkout pull/13716
Update a local copy of the PR:
$ git checkout pull/13716
$ git pull https://git.openjdk.org/jdk.git pull/13716/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13716
View PR using the GUI difftool:
$ git pr show -t 13716
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13716.diff
Webrev
Link to Webrev Comment