RFR: 8331539: [REDO] NMT: add/make a mandatory MEMFLAGS argument to family of os::reserve/commit/uncommit memory API

Afshin Zafari azafari at openjdk.org
Wed May 22 08:34:25 UTC 2024


This PR fixes the problems existed in the original PR (https://github.com/openjdk/jdk/pull/18745).  There are two main fixes here:
  1- `ReservedSpace` class is changed so that the `_flag` member never changes after it is set in ctor. Since reserving memory regions may go thru a try and fail sequence of reserve-release pairs, changing the `_flag` member at failed releases would lead to incorrect flags in subsequent reserves.
Also, some assertion are added to the getters of a `ReservedSpace` to check if the region is successfully reserved.

  2- In order to have adjacent regions with different flags, CDS reserves a (large) region `R` and then splits it into sub regions `R1` and `R2` (`R == <---R1---><--R2-->`). At release time, NMT tracks only `R` and ignores releasing `R1` and `R2`. This ignoring is problematic when a requested region `R` is size-aligned to `R1---R---R2` first and then the `R1` and `R2` released (`chop_extra_memory` function is called for this). In this case, NMT ignores tracking `R1` and `R2` with assumption that a containing `R` will be released. Therefore, `R1` and `R2` remain in the NMT region-list and when a new reserve happens at that regions, NMT complains by raising an exception.

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

Commit messages:
 - 8331539: [REDO] NMT: add/make a mandatory MEMFLAGS argument to family of os::reserve/commit/uncommit memory API

Changes: https://git.openjdk.org/jdk/pull/19343/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19343&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8331539
  Stats: 609 lines in 62 files changed: 78 ins; 148 del; 383 mod
  Patch: https://git.openjdk.org/jdk/pull/19343.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19343/head:pull/19343

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


More information about the shenandoah-dev mailing list