RFR: 8253650: Cleanup: remove alignment_hint parameter from os::reserve_memory
Stefan Karlsson
stefank at openjdk.java.net
Wed Sep 30 11:03:44 UTC 2020
On Wed, 30 Sep 2020 10:08:09 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> Hi all,
>
> since ancient times os::reserve_memory() carried around an "alignment_hint" parameter. It was undocumented but from the
> name it suggests it would cause os::reserve_memory() to try to align the start of the mapping to a given alignment.
> However, the only platform ever doing anything with this parameter was AIX, and there only in mmap() mode. All other
> platforms ignored the parameter. So it can be removed, provided we fix the AIX case.
> Notes:
> - if one really needs alignment memory, there is os::reserve_memory_aligned() which guarantees the alignment. It will do
> the usual over-reserving-and-chopping-away to do that.
> - On AIX there is a second reason why we align the mmap() result pointer to 64K, since we "fake" 64K pages in some
> places. I disentangled that alignment handling from the caller provided alignment.
> - This affects os::reserve_memory() as well as the new os::reserve_memory_with_fd()
> - I also fixed comments in virtualSpace.cpp which do not apply anymore after JDK-8253638
>
> Tests: tier1, manual builds and tests on AIX
Great! Thanks for cleaning this up. I'm glad that you took care of this, since you know about the AIX code and its
history.
I've marked some nits that you might want to clean up with this patch.
src/hotspot/share/memory/virtualspace.cpp line 377:
> 375: base = os::attempt_reserve_memory_at(requested_address, size, _fd_for_heap);
> 376: } else {
> 377: // Optimistically assume that the OSes returns an aligned base pointer.
Pre-existing, but maybe change "OSes returns" to "OSes return"
src/hotspot/os/posix/os_posix.cpp line 321:
> 319: // For file mapping, we do not call os:reserve_memory() because
> 320: // we need to deal with shrinking of the file space later when we release extra memory after alignment.
> 321: // We also cannot called os:reserve_memory() with file_desc set to -1 because on aix we might get SHM memory.
Pre-existing: "Cannot called " => "Cannot call"
-------------
Marked as reviewed by stefank (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/430
More information about the hotspot-dev
mailing list