RFR: 8325108: POSIX map_memory_to_file calls release_memory unnecessarily [v2]
Coleen Phillimore
coleenp at openjdk.org
Thu Jan 8 23:21:45 UTC 2026
On Thu, 8 Jan 2026 18:34:08 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> 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
Looks good!
-------------
Marked as reviewed by coleenp (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/29081#pullrequestreview-3641698086
More information about the hotspot-runtime-dev
mailing list