RFR: 8372150: Parallel: Tighten requirements around MinHeapSize with NUMA and Large Pages

Joel Sikström jsikstro at openjdk.org
Wed Nov 19 16:21:47 UTC 2025


Hello,

Today, Parallel decides to opt out of using Large pages if the initial heap size does not cover enough Large pages for all spaces. Additionally, if we don't get enough initial heap size for at least one OS page per MutableNUMASpace (one per NUMA-node), Parallel decides to run in a NUMA-degraded mode, where it skips allocating memory locally for some NUMA-nodes. Both of these issues are problematic if we want to start the JVM with a default initial heap size that is equal to the minimum heap size (see [JDK-8371986](https://bugs.openjdk.org/browse/JDK-8371986)). To solve this, we should consider making sure that the minimum heap size is always enough to cover precisely one page per space, where the page size may be Large or not. By making sure the minimum heap size covers this, we never have to disable Large pages or run in a NUMA-degraded mode based on the setting of the initial heap size.

For completeness, when user-proided settings for UseNUMA, UseLargePages and InitialHeapSize can't be satisfied at the same time, one must be prioritised over others. Today, we prioritise InitialHeapSize over both UseNUMA and UseLargePages. This change suggest shifting the priority to UseNUMA and UseLargePages, by bumping MinHeapSize to an adequate number. Bumping MinHeapSize directly affects InitialHeapSize, since InitialHeapSize must be equal to or greater than MinHeapSize.
 
<details>

<summary><b>Min and Initial heap sizes before/after</b> (expandable section)</summary>

Before changes. We always get Min&Initial 2MB that we request:

java -XX:+UseParallelGC -Xms2M -Xmx1G
Alignments: Space 512K, Heap 2M
Heap Min Capacity: 2M
Heap Initial Capacity: 2M

java -XX:+UseParallelGC -XX:+UseLargePages -Xms2M -Xmx1G
MinHeapSize (2097152) must be large enough for 4 * page-size; Disabling UseLargePages for heap
Alignments: Space 512K, Heap 2M
Heap Min Capacity: 2M
Heap Initial Capacity: 2M

java -XX:+UseParallelGC -XX:+UseNUMA -Xms2M -Xmx1G
Alignments: Space 512K, Heap 2M
Heap Min Capacity: 2M
Heap Initial Capacity: 2M

java -XX:+UseParallelGC -XX:+UseLargePages -XX:+UseNUMA -Xms2M -Xmx1G
MinHeapSize (2097152) must be large enough for 4 * page-size; Disabling UseLargePages for heap
Alignments: Space 512K, Heap 2M
Heap Min Capacity: 2M
Heap Initial Capacity: 2M


After changes. We bump Min, and in turn also Initial, to accommodate enough Large Pages for all spaces. This is run on a NUMA machine with two NUMA nodes, so we get an extra 2MB when NUMA is enabled for the additional eden space.

java -XX:+UseParallelGC -Xms2M -Xmx1G
Alignments: Space 512K, Heap 2M
Heap Min Capacity: 2M
Heap Initial Capacity: 2M

java -XX:+UseParallelGC -XX:+UseLargePages -Xms2M -Xmx1G
Alignments: Space 2M, Heap 2M
Heap Min Capacity: 8M
Heap Initial Capacity: 8M

java -XX:+UseParallelGC -XX:+UseNUMA -Xms2M -Xmx1G
Alignments: Space 512K, Heap 2M
Heap Min Capacity: 4M
Heap Initial Capacity: 4M

-XX:+UseParallelGC -XX:+UseLargePages -XX:+UseNUMA -Xms2M -Xmx1G
Alignments: Space 2M, Heap 2M
Heap Min Capacity: 10M
Heap Initial Capacity: 10M

</details>

Since the usage of `UseLargePages` may bump the Min and Initial heap sizes, I've opted to not run `TestParallelHeapSizeFlags` with `UseLargePages` enabled.

Testing:
* Oracle's tier1-4
* tier1-3 with the flags `-XX:+UseParallelGC -XX:+UseLargePages -XX:+UseNUMA`

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

Commit messages:
 - 8372150: Parallel: Tighten requirements around MinHeapSize with NUMA and Large Pages

Changes: https://git.openjdk.org/jdk/pull/28394/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28394&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8372150
  Stats: 83 lines in 9 files changed: 20 ins; 52 del; 11 mod
  Patch: https://git.openjdk.org/jdk/pull/28394.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28394/head:pull/28394

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


More information about the hotspot-dev mailing list