JDK-8255254 : Split os::reserve_memory and os::map_memory_to_file interfaces
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-10-22
  • Updated: 2021-11-02
  • Resolved: 2020-10-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b22Fixed
Related Reports
Relates :  
Relates :  
Description
reserve_memory and map_memory_to_file are substantially different interfaces. Reserve expects subsequent commit/uncommit and is removed by release_memory. Map_memory_to_file does not allow commit/uncommit and is removed by os::unmap_memory.

But for now, some os::*reserve_memory* functions take file descriptor parameter[1] and, if it is valid descriptor, act effectively as map_memory_to_file[2]. Callers are aware that commit/uncommit cannot be called for reserved-with-fd memory[3]. Callers are also know about different ways to remove the mapping[4].

The suggestion is to make clear distinctions between reserve_memory and map_memory_to_file interfaces

[1] https://github.com/openjdk/jdk/blob/4634dbe/src/hotspot/share/runtime/os.hpp#L321
[2] https://github.com/openjdk/jdk/blob/4634dbe/src/hotspot/share/runtime/os.cpp#L1667
[3] https://github.com/openjdk/jdk/blob/4634dbe/src/hotspot/share/memory/virtualspace.cpp#L225
[4]https://github.com/openjdk/jdk/blob/4634dbe/src/hotspot/share/memory/virtualspace.cpp#L84
Comments
Changeset: acd0e256 Author: Anton Kozlov <akozlov@openjdk.org> Committer: Vladimir Kempik <vkempik@openjdk.org> Date: 2020-10-27 20:37:01 +0000 URL: https://git.openjdk.java.net/jdk/commit/acd0e256
27-10-2020