RFR: 8372747: G1: Conservative heap alignment does not account for card table constraint

Joel Sikström jsikstro at openjdk.org
Mon Dec 1 09:34:40 UTC 2025


Hello,

We removed `GCArguments::compute_heap_alignment` in [JDK-8372150](https://bugs.openjdk.org/browse/JDK-8372150) to simplify the interface a bit, with the expecation that each GC handles alignment on their own. This is true when the default "small" page size is 4K, but with 64K default "small" pages on PPC, this assumption doesn't hold. To fix this, we should make sure to account for the card table constraints in `G1Arguments::conservative_max_heap_alignment`.

I've tested this locally by changing the following line to "emulate" 64K default "small" pages, which I've used to confirm this fix.

 uintx CardTable::ct_max_alignment_constraint() {
   // Calculate maximum alignment using GCCardSizeInBytes as card_size hasn't been set yet
-  return GCCardSizeInBytes * os::vm_page_size();
+  return GCCardSizeInBytes * 64 * K;
 }


Also tested with Oracle's tier1-4.

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

Commit messages:
 - 8372747: G1: Conservative heap alignment does not account for card table constraint

Changes: https://git.openjdk.org/jdk/pull/28572/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28572&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8372747
  Stats: 5 lines in 1 file changed: 1 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/28572.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28572/head:pull/28572

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


More information about the hotspot-gc-dev mailing list