JDK-8260262 : Use common code in function unmap_shared() in perfMemory_posix.cpp
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-01-21
  • Updated: 2021-08-10
  • Resolved: 2021-08-10
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 18
18 masterFixed
Related Reports
Relates :  
Relates :  
Description
This issue came from @stuefe review of 8134540:

The existing code in unmap_shared() in perfMemory_posix.cpp differs between AIX and other platforms:

static void unmap_shared(char* addr, size_t bytes) {
#if defined(_AIX)
  // Do not rely on os::reserve_memory/os::release_memory to use mmap.
  // Use os::reserve_memory/os::release_memory for PerfDisableSharedMem=1, mmap/munmap for PerfDisableSharedMem=0
  if (::munmap(addr, bytes) == -1) {
    warning("perfmemory: munmap failed (%d)\n", errno);
  }
#else
  os::release_memory(addr, bytes);
#endif
}

The AIX code's explicit call to munmap would work for the other platforms but ignores memory tracking.  The other code path works for AIX but, since on creation, we call raw ::mmap(). Then, perhaps we should call raw ::munmap here too. Otherwise this relies on the fact that os::reserve_memory always uses mmap(), which is not given.
Comments
Changeset: 2b05fae1 Author: Harold Seigel <hseigel@openjdk.org> Date: 2021-08-10 12:17:08 +0000 URL: https://git.openjdk.java.net/jdk/commit/2b05fae15568d5eb91d6d6d32c29f2fda453a8f5
10-08-2021