RFR: 8272773: Configurable card table card size [v8]

Albert Mingkun Yang ayang at openjdk.java.net
Thu Nov 18 21:55:48 UTC 2021

On Thu, 18 Nov 2021 09:55:07 GMT, Vishal Chand <duke at openjdk.java.net> wrote:

>> Hi,
>> Please review the changes to make CardTable entry size configurable. The changes primarily consists of:
>> 1. Addition of a cmdline flag **GCCardSizeInBytes** to make the card size startup time configurable.
>> 2. Setting the card size based on the flag in G1, Parallel and Serial GC memory initialization paths.
>> 3. Setting BlockOffsetTable size and ObjectStartArray size based on the card size.
> Vishal Chand has updated the pull request incrementally with one additional commit since the last revision:
>   Change to avoid compilation issue in hs builds

src/hotspot/share/gc/g1/g1CollectedHeap.cpp line 1663:

> 1661:   // The G1FromCardCache reserves card with value 0 as "invalid", so the heap must not
> 1662:   // start within the first card.
> 1663:   guarantee(heap_rs.base() >= (char*)(uintptr_t)(G1CardTable::card_size), "Java heap must not start within the first card.");

How about `(uintptr_t)heap_rs.base() >= G1CardTable::card_size`? Converting an arbitrary integer to a pointer is implementation-defined.

src/hotspot/share/gc/g1/heapRegion.cpp line 94:

> 92: 
> 93:   // Initialize card size
> 94:   CardTable::initialize_card_size();

I see that `CardTable::initialize_card_size()` is called at the beginning of `GCArguments::initialize_alignments()` for Serial and Parallel. I wonder if it makes sense to do the same for G1.

src/hotspot/share/gc/shared/cardTable.cpp line 457:

> 455: 
> 456: uintx CardTable::ct_max_alignment_constraint() {
> 457:   return GCCardSizeInBytes * os::vm_page_size();

The reason why `card_size` can't be used here is that `card_size` haven't been set when this method is called, correct? If so, please put a comment here.


PR: https://git.openjdk.java.net/jdk/pull/5838

More information about the hotspot-gc-dev mailing list