RFR: 8314972: GenShen: promote_in_place needs to prepare remembered set before it enables old allocations within region

Y. Srinivas Ramakrishna ysr at openjdk.org
Fri Aug 25 17:19:57 UTC 2023


On Fri, 25 Aug 2023 16:57:05 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 1020:
> 
>> 1018:   assert(get_top_before_promote() == tams, "Cannot promote regions in place if top has advanced beyond TAMS");
>> 1019: 
>> 1020:   // Since this region may have served previously as OLD, it may hold obsolete object range info.
> 
> Why don't we clear the range when an old region is freed, rather than waiting for it to become old? Then we could assert here that the range is clear. Young regions wouldn't register objects so nothing would need to be done for young regions.

May be modify the comment to state something like:
// Clear any obsolete object start information; we'll register the live objects in the loop below,
// as well as registering and stamping free block fillers over dead objects.
// We also dirty the card table for the entire allocated range; it'll be updated/refined when we
// scan it next time for young pointers.

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

PR Review Comment: https://git.openjdk.org/shenandoah/pull/310#discussion_r1305930519


More information about the shenandoah-dev mailing list