-
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
JDK-8275582: Don't purge metaspace mapping lists #6036
Conversation
👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into |
1cbe0a0
to
10ad2af
Compare
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 great!
@tstuefe 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 106 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 to me. Much simpler this way. Thanks for the great description of the change!
Going to push as commit 3ff085e.
Your commit was automatically rebased without conflicts. |
Metaspace, at its lowest level, keeps a list of memory mappings. That list is dynamically expandable, which makes Metaspace expandable as well, one of the key features of this allocator.
There are two mechanisms in place in Metaspace to return memory to the OS:
(1) is the old way, existing since the inception of Metaspace. It works by unmapping and deleting mapping segments which are fully evacuated. Metaspace allocations are fine granular and cannot move, so Metaspace is subject to fragmentation. That fragmentation makes (1) rather ineffective since we only can unmap a mapping that had been fully free'd after class unloading. The mappings however are quite large (and we plan to make them larger still), the chance of one being completely empty is small.
(2) was introduced with JEP-387 and is much more effective. We return memory not on a mapping level, but on a chunk level, by uncommitting free chunks larger than a certain threshold. That works very well.
When working on JEP-387, I left (1) in place out of caution. But (1) is really not needed anymore. It has no effect in combination with (2) because if a whole mapping is free and eligible for unmapping using technique(1), all its chunks must be free, will have been maximally folded by the buddy allocator, and their backing memory will have been completely uncommitted. So unmapping that segment has no effect on the process' RSS.
Removing (1) would have the following advantages:
Removing the ability to purge the mapping list means we retain the uncommitted virtual address space of those mappings after spikes in class unloading. But the consequences of that are minimal, it does not affect RSS at all.
This patch removes old-style metaspace node purging completely. Therefore it's almost all line deletions.
Tests:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6036/head:pull/6036
$ git checkout pull/6036
Update a local copy of the PR:
$ git checkout pull/6036
$ git pull https://git.openjdk.java.net/jdk pull/6036/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6036
View PR using the GUI difftool:
$ git pr show -t 6036
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6036.diff