RFR: JDK-8211955: GC abstraction for LAB reserve
rkennke at redhat.com
Tue Oct 9 20:16:26 UTC 2018
TLABs need to be made parseable before GC. This means to fill remaining
space with a dummy object, so that there remain no holes in the heap,
and the heap becomes contiguously filled with objects. However, since we
cannot (generally) fill holes with arbitrarily small objects, we need an
'allocation reserve' at the end of TLABs (and PLABs).
Current PLAB and TLAB reserve assumes a specific object size. GCs like
Shenandoah need to allocate a little more space per object and thus
require some abstraction to get the minimum filler object size /
This change proposes an API in CollectedHeap to determine the minimum
filler object size. It also proposes some consolidation between TLAB and
PLAB in this respect. plab.cpp has this logic to calculate the reserve:
AlignmentReserve = oopDesc::header_size() > MinObjAlignment ?
align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
The idea is that if obj-alignment is larger/equal than min-object-size,
then we don't need a reserve, because we can always make the filler fit.
Otherwise, we choose the min-array-size (3 words). The reason for the
latter eludes me: it should be enough to choose the minimum object size
TLAB always uses min-array-size, and does not take MinObjAlignment into
I propose to add two methods to CollectedHeap:
virtual size_t min_dummy_object_word_size() const;
to return the minimum possible filler object size. GCs can override this
to return a different size (e.g. Shenandoah would return one extra word
here). And then:
size_t tlab_alloc_reserve() const;
to calculate the allocation reserve, using the logic from PLAB that
takes MinObjAlignment into account. This uses
min_dummy_object_word_size() and would be used by both TLAB and PLAB.
What do you think?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: OpenPGP digital signature
More information about the hotspot-gc-dev