-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8363932: G1: Better distribute KlassCleaningTask #27316
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
base: master
Are you sure you want to change the base?
8363932: G1: Better distribute KlassCleaningTask #27316
Conversation
* parallelize on CLD, not on klasses * initial cleanup
👋 Welcome back tschatzl! A progress list of the required criteria for merging this PR into |
@tschatzl 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 95 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 |
@tschatzl this pull request can not be integrated into git checkout submit/8363932-klasstaskcleaning-distribution
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
… repeating the walk
/label add hotspot-gc |
@tschatzl |
@tschatzl |
@tschatzl |
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.
Preexisting: These two methods, subklass
and next_sibling
, sounds like plain getters, but they actually query liveness and skip dead klasses. I wonder whether it's possible to prune dead klasses in one go at some place and turn these two methods into plain getters.
|
||
bool claim_clean_klass_tree_task(); | ||
InstanceKlass* claim_next_klass(); | ||
ClassLoaderDataGraphIteratorAtomic _cld_iterator; |
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 suggest adding _atomic
suffix to the field name.
@tschatzl |
/label remove hotspot |
@tschatzl |
@tschatzl |
@tschatzl |
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 to me. I think your explanation makes sense and the example helps very much.
Hi all,
please review this change to parallel klass cleaning to improve performance.
The current implementation only parallelizes cleaning of weak class links, while the main work, cleaning the object tree is single-threaded. Hence in practice, the current mechanism does not scale beyond 2-3 threads.
Cleaning an object graph in an application that loads some jars and instantiates central classes within them, with around 180k classes the current
G1 Complete Cleaning
task (which executes this code) can take 80ms (with 25 threads).The suggested change is to walk the object graph by (live)
ClassLoaderData
klass by klass, fixing only the links of that particular klass.E.g.
CLD 3 is dead. Thread 1 claims CLD 1, Thread 2 claims CLD 2 (and nobody claims CLD3 because it's dead).
So thread 1, when reaching
A
fixes its subklass link toC
, and otherwise does nothing withA
. When looking atC
, it will remove the link to1
.Thread 2 will only remove the link to
3
ofc
.The result is
There should be no unnecessary object graph walking.
There is a slight change in printing during unlinking: previously the code, when cleaning subklasses it printed
unlinking class (subclass)
for every class that has been removed on the way to the next live one. In above case, it would printWith the change, to avoid following the subklasses of the graph twice, it prints
because the string in brackets is the actual link that is followed. I can revert that change.
With the change "Complete Cleaning" time for 200k classes takes 7.6ms (The test is a bit random on when it does the class unloading).
Testing: tier1-5
Thanks,
Thomas
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27316/head:pull/27316
$ git checkout pull/27316
Update a local copy of the PR:
$ git checkout pull/27316
$ git pull https://git.openjdk.org/jdk.git pull/27316/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27316
View PR using the GUI difftool:
$ git pr show -t 27316
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27316.diff
Using Webrev
Link to Webrev Comment