RFR: JDK-8313319: [linux] mmap should use MAP_FIXED_NOREPLACE if available

Thomas Stuefe stuefe at openjdk.org
Tue Aug 8 05:58:52 UTC 2023


On Sun, 6 Aug 2023 17:09:41 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> os::attempt_reserve_memory_at() is used to map memory at a specific address that we fancy. It is not used to replace an existing mapping (hence we omit MAP_FIXED). 
> 
> But it may result in the kernel creating a mapping at a different address if our wish address is blocked; we then have to unmap again. That mmap-munmap cycle is unnecessary.
> 
> MAP_FIXED_NOREPLACE exists since Linux 4.17 and prevents that unnecessary cycle . We should use that if available.

Windows x64 GHA errors unrelated

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15170#issuecomment-1668950561


More information about the hotspot-runtime-dev mailing list