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

Afshin Zafari azafari at openjdk.org
Fri May 24 10:03:27 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` are released (`chop_extra_memory` function is called for this). In this case, NMT ignores tracking `R1` and `R2` with false assumption that a containing `R` will be released. Therefore, `R1` and `R2` remain in the NMT reserved-regions-list and when a new reserve happens at that regions, NMT complains by raising an exception.
> 
> Tests:
> mach5 tiers 1-5, {linux-x64, macosx-aarch64, windows-x64, linux-aarch64 } x {debug, non-debug}

Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:

  applied review comments.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19343/files
  - new: https://git.openjdk.org/jdk/pull/19343/files/86ae1e37..c7ff3867

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

  Stats: 16 lines in 3 files changed: 2 ins; 5 del; 9 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