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

Afshin Zafari azafari at openjdk.org
Wed May 22 12:09:14 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.

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

  fixed the missing parts of shenandoahHeap.cpp

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

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

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

  Stats: 122 lines in 1 file changed: 94 ins; 23 del; 5 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