RFR: JDK-8307314: Implementation: Generational Shenandoah (Experimental) [v4]

Kelvin Nilsen kdnilsen at openjdk.org
Tue Jun 6 23:24:34 UTC 2023


On Fri, 2 Jun 2023 17:55:56 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:

>> Kelvin Nilsen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Force PLAB sizes to align on card-table size
>
> src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 1285:
> 
>> 1283:   if (unalignment != 0) {
>> 1284:     word_size = word_size - unalignment + CardTable::card_size_in_words();
>> 1285:   }
> 
> Probably not a big deal since this is only used when refilling a PLAB, which is an infrequent operation, but `mod` is an expensive operation, in general, and best to avoid in our code except in assertion checks (or even there given recent experiences with debug tests timing out). Since card size is a power of 2, may be we could use addition and masking instead. Something like defining the following inline in the CardTable class and using it everywhere where card alignment granularity is sought. There may even be a macro or method defined for this already perhaps:
> 
> 
> (FOO + CardSize - 1) & ~((1 << LogCardSize) - 1)
> 
> 
> One could even store the mask to avoid the arithmetic to produce the mask although it's pretty cheap.
> 
> This may turn out to be less expensive than mod, test, and branch, but as I said probably not a big deal here. We should make sure we don't overuse mods in our allocation paths much.

Thanks for this suggestion.  I've modified the code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14185#discussion_r1220523992


More information about the serviceability-dev mailing list