RFR: 8354922: ZGC: Use MAP_FIXED_NOREPLACE when reserving memory

Stefan Karlsson stefank at openjdk.org
Thu Apr 17 11:22:55 UTC 2025


We have seen that some versions of the Linux kernel does not honor the address hint when mmapping memory without MAP_FIXED, if there is an adjacent memory area above the requested memory area. If we use MAP_FIXED_NOREPLACE, the reservation succeeds. I propose that we start using MAP_FIXED_NOREPLACE.

Tested via GHA, which runs the gtest that performs a discontiguous, but adjacent reservation. I will run this through a bunch of tiers before integrating.

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

Commit messages:
 - 8354922: ZGC: Use MAP_FIXED_NOREPLACE when reserving memory

Changes: https://git.openjdk.org/jdk/pull/24716/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24716&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8354922
  Stats: 10 lines in 2 files changed: 9 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/24716.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24716/head:pull/24716

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


More information about the hotspot-gc-dev mailing list