RFR: 8354358: ZGC: ZPartition::prime handle discontiguous reservations correctly

Axel Boldt-Christmas aboldtch at openjdk.org
Fri Apr 11 06:20:11 UTC 2025


Prior to [JDK-8350441](https://bugs.openjdk.org/browse/JDK-8350441) the VM would not have started if we received a discontiguous heap reservation with all reservations smaller than the inital heap capacity. Now we crash because `ZPartition::prime` does not take this into account.

However in contrast to the page cache, the mapped cache makes it trivial to support this scenario. So I propose fixing `ZPartition::prime` to handle any discontiguous heap reservation.

Can be provoked in a debug build by using ZForceDiscontiguousHeapReservations > 16
`java -XX:+UseZGC -XX:ZForceDiscontiguousHeapReservations=17 -Xmx128m -Xms128m --version`

Currently running this through testing.

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

Commit messages:
 - 8354358: ZGC: ZPartition::prime handle discontiguous reservations correctly

Changes: https://git.openjdk.org/jdk/pull/24589/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24589&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8354358
  Stats: 31 lines in 2 files changed: 7 ins; 2 del; 22 mod
  Patch: https://git.openjdk.org/jdk/pull/24589.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24589/head:pull/24589

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


More information about the hotspot-gc-dev mailing list