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

Thomas Stuefe stuefe at openjdk.org
Thu Aug 24 05:21:58 UTC 2023


> 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. We need to tiptoe around a bit to deal with building on old machines/running on old kernels, though.

Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:

  tzpo

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15170/files
  - new: https://git.openjdk.org/jdk/pull/15170/files/2dfa2bf3..b1da1191

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15170&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15170&range=02-03

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/15170.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15170/head:pull/15170

PR: https://git.openjdk.org/jdk/pull/15170


More information about the hotspot-runtime-dev mailing list