RFR: Usage tracking cleanup

William Kemper wkemper at openjdk.org
Wed Apr 19 00:14:20 UTC 2023


On Wed, 19 Apr 2023 00:07:13 GMT, William Kemper <wkemper at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 275:
>> 
>>> 273:   assert(result != nullptr, "Allocation cannot fail");
>>> 274:   assert(r->top() <= r->end(), "Allocation cannot span end of region");
>>> 275:   assert(req.actual_size() % CardTable::card_size_in_words() == 0, "PLAB size must be multiple of card size");
>> 
>> We've already checked at line 270 that `size % CardTable::card_size_in_words() == 0`. I think we can check a stronger condition here, i.e.:
>> 
>> assert(req.actual_size() == size, "Unexpected actual_size()");
>
> Hmm... I'm not sure about that. In the case when elastic TLABs is enabled, we will have already decreased size to fit in the region and so we don't expect to `allocate_aligned` to further decrease the size. However, in the case when elastic TLABs is disabled we can't be sure that `allocate_aligned` will not set `actual_size` to something smaller than the requested `size`. This arguably violates the intention behind disabling elastic TLABs, but I think this is a matter for a different PR?

Never mind, I see that when elastic TLABs are disabled and we only `allocate_aligned` if we know the request will fit.

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

PR Review Comment: https://git.openjdk.org/shenandoah/pull/260#discussion_r1170680721


More information about the shenandoah-dev mailing list