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
JDK-8276731: Metaspace chunks are uncommitted twice #6277
JDK-8276731: Metaspace chunks are uncommitted twice #6277
Conversation
|
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 makes sense to me. Uncommitting when returning the chunk to ChunkManager (which I think implies the potential for reuse) is somewhat unexpected. The uncommits should quite probably be separate, as your patch currently does.
@tstuefe This change now passes all automated pre-integration checks. 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 35 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.
|
Exactly. Thanks for the review! |
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 think this is fine. But now get_chunk won't uncommit memory, so could there be a scenario where we need to uncommit chunks outside of class unloading? I sort of doubt it but haven't thought about it for a long time. What do you think?
Hi Coleen, thanks for thinking about this again :) No, there is no reason to uncommit outside of class unloading. It's actually the other way around: As you noticed, the only other caller of |
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.
Great. I like this change then.
Thank you Coleen! |
/integrate |
Going to push as commit 4bd5bfd.
Your commit was automatically rebased without conflicts. |
Small patch for a minor, benign error, which just eats up a bit of unnecessary processing time.
Metaspace returns memory to the OS by uncommitting free chunks when we unload classes. Today, we uncommit free metaspace chunks twice, and the second uncommit has no effect. Therefore, one of the uncommits is unnecessary.
In detail, when class unloading happens, we enter CLDG::purge():
CLDG::purge()
_unloading
listChunkManager::return_chunk()
)then we pop back to CLDG::purge() and call
Metaspace::purge()
Metaspace::purge()
iterates through all free chunks in the chunk manager, now maximally folded, and uncommits those which are larger than a commit granule.(A) and (B) are redundant. (B) uncommits memory which had already been uncommitted in step (A). Either A or B could be dropped.
I opt for keeping (B) and dropping (A) since:
Metaspace::purge()
to do some purging.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6277/head:pull/6277
$ git checkout pull/6277
Update a local copy of the PR:
$ git checkout pull/6277
$ git pull https://git.openjdk.java.net/jdk pull/6277/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6277
View PR using the GUI difftool:
$ git pr show -t 6277
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6277.diff