RFR: 8325108: POSIX map_memory_to_file calls release_memory unnecessarily [v2]
Johan Sjölen
jsjolen at openjdk.org
Thu Jan 8 18:34:08 UTC 2026
> The implementation of the function os::map_memory_to_file calls os::release_memory if a mmap:ing to a fixed location succeeds but is not at the requested location. A POSIX implementation of mmap is not allowed to succeed and return a different base address if `MAP_FIXED` is supplied, so this is dead code. We can remove it.
>
> Quote:
>
>>When MAP_FIXED is set in the flags argument, the implementation is informed that the value of pa shall be addr, exactly. If MAP_FIXED is set, mmap() may return MAP_FAILED and set errno to [EINVAL]. If a MAP_FIXED request is successful, the mapping established by mmap() replaces any previous mappings for the process' pages in the range [pa,pa+len).
>
> https://pubs.opengroup.org/onlinepubs/009604499/functions/mmap.html
Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
Check for expected invariant
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/29081/files
- new: https://git.openjdk.org/jdk/pull/29081/files/f5bf7141..55ffac69
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=29081&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=29081&range=00-01
Stats: 4 lines in 1 file changed: 4 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/29081.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29081/head:pull/29081
PR: https://git.openjdk.org/jdk/pull/29081
More information about the hotspot-runtime-dev
mailing list