RFR: 8316319: Generational ZGC: The SoftMaxHeapSize might be wrong when CDS decreases the MaxHeapSize

Stefan Karlsson stefank at openjdk.org
Wed Sep 20 12:46:59 UTC 2023


Generational ZGC sets SoftMaxHeapSize to 90% of the MaxHeapSize if the user has not specified the maximum heap size with any of the available flags. Unfortunately, this break when CDS later on decreases the MaxHeapSize.

I propose that we solve this by moving the code that sets the SoftMaxHeapSize to the point after CDS and the GC has done its final tweaks to the MaxHeapSize.

This can be easily reproduced just by running:
java -XX:+UseZGC -XX:+ZGenerational -Xshare:dump -Xlog:gc+init -version

This wasn't caught in testing because our test infrastructure uses MaxRamPercentage to set the maximum heap size. I've manually verified that the patch fixes the issue and that SoftMaxHeapSize is set as expected.

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

Commit messages:
 - 8316319: Generational ZGC: The SoftMaxHeapSize might be wrong when CDS decreases the MaxHeapSize

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

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


More information about the hotspot-gc-dev mailing list