RFR: 8314972: GenShen: promote_in_place needs to prepare remembered set before it enables old allocations within region
Kelvin Nilsen
kdnilsen at openjdk.org
Fri Aug 25 17:55:44 UTC 2023
On Fri, 25 Aug 2023 17:26:28 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:
>> An error in the original implementation left us vulnerable to a race between a worker thread which is promoting a region in place and another worker or mutator thread who is allocating memory for old objects within the same region.
>>
>> This PR prevents this race by requiring the worker thread that promotes a region in place to finish the preparation of the region's remembered set before it makes the region available to other threads for allocation of old-gen memory.
>
> src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp line 1040:
>
>> 1038: assert(fill_size >= ShenandoahHeap::min_fill_size(), "previously allocated objects known to be larger than min_size");
>> 1039: ShenandoahHeap::fill_with_object(obj_addr, fill_size);
>> 1040: heap->card_scan()->register_object_without_lock(obj_addr);
>
> On second thoughts, do we really need to register the dead objects? Does it help at all, since the preceding and succeeding live objects will be registered anyway. Not wrong, but I do wonder if it helps at all or not. Probably not a big deal either way since dead objects are likely very few in regions promoted in place.
Existing code (and some existing assertions in ShenandoahVerifier) expect the filler objects to be registered. You make a good point though. We don't really need these to be registered. If the first or only object in a card range is a filler, remembered set scanning can just ignore that. The remembered set scanner wants to find the first non-filler object in the range. We might want to address this in a separate ticket later, if we decide to keep the current remembered set representation longer term.
-------------
PR Review Comment: https://git.openjdk.org/shenandoah/pull/310#discussion_r1305972752
More information about the shenandoah-dev
mailing list