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:55 UTC 2023
On Thu, 24 Aug 2023 21:44:29 GMT, Kelvin Nilsen <kdnilsen 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.
LGTM. 🚢
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.
-------------
Marked as reviewed by ysr (Committer).
PR Review: https://git.openjdk.org/shenandoah/pull/310#pullrequestreview-1596144705
PR Review Comment: https://git.openjdk.org/shenandoah/pull/310#discussion_r1305917208
More information about the shenandoah-dev
mailing list