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

Thomas Stuefe stuefe at openjdk.org
Wed Aug 16 14:24:44 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.

Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:

 - Merge branch 'openjdk:master' into JDK-8313319-MAP_FIXED_NOREPLACE
 - DK-8313319-MAP_FIXED_NOREPLACE

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15170/files
  - new: https://git.openjdk.org/jdk/pull/15170/files/bd17fe2d..c2a2b760

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

  Stats: 16603 lines in 734 files changed: 7498 ins; 3628 del; 5477 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