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-8266222: [aix] In mmap-mode, partial releases with os::release_memory may trash internal bookkeeping #3765
Conversation
|
@@ -1989,6 +1989,7 @@ bool os::pd_release_memory(char* addr, size_t size) { | |||
// Dynamically do different things for mmap/shmat. | |||
vmembk_t* const vmi = vmembk_find(addr); | |||
guarantee0(vmi); | |||
vmi->assert_is_valid_subrange(addr, size); |
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.
Reviewer note: this is unrelated to the problem, I just lifted the assert call from both branches and made it independent from debug/release.
@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 112 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.
|
Danke, Martin! |
Note that since we don't have that many AIX reviewers, and this only concerns AIX code, I go ahead and push. Its our port anyway, if something breaks we will have to fix it. /integrate |
@tstuefe Since your change was applied there have been 114 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 250b45a. |
In os_aix.cpp we keep book about for reserved address ranges since we need to keep information about which API (mmap or shmat) had been used for this range. (code hint: see vmembk_(add|remove|find)).
When releasing memory via os::release_memory, we remove those ranges from the internal bookkeeping.
However, for mmap() the release may be partial. In that case the internal bookkeeping is not updated correctly: we just remove the record for the whole original address range.
After that operation, the remainder address range is still mapped from the point of the VM, but the bookkeeping is lost and subsequent calls to os::release_memory or os::commit/uncommit_memory for this range will run into a guarantee.
Partial releases can happen e.g. when, in the process of running os::reserve_memory_aligned(), the extra-aligned pages are unmapped. This is of more concern now with the new Metaspace, since we now reserve with larger alignments (4G+).
This problem was hidden by the fact that we typically run in 64K paged mode where we use SysV shared memory; but if AME is enabled on AIX, 64K pages are disabled, and the VM falls back to 4K pages and using mmap, and runs into this bug.
Edit: Tested on AIX machines with and without AME activated, solves the problems. All SAP nightlies ran, no problems caused by this patch.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3765/head:pull/3765
$ git checkout pull/3765
Update a local copy of the PR:
$ git checkout pull/3765
$ git pull https://git.openjdk.java.net/jdk pull/3765/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3765
View PR using the GUI difftool:
$ git pr show -t 3765
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3765.diff