RFR: 8338737: Shenandoah: Reset marking bitmaps after the cycle

Xiaolong Peng xpeng at openjdk.org
Thu Oct 17 21:44:32 UTC 2024


On Thu, 17 Oct 2024 21:25:54 GMT, William Kemper <wkemper at openjdk.org> wrote:

> I have some concerns about the correctness here. Consider this scenario:
> 
> 1. At the end of a young _or mixed_ collection, `op_reset_after_collect` will reset young regions and unset the `needs reset` flag for the young generation.
> 2. An old region (A) from the mixed collection could be repurposed as a young region (it's bitmap will not be reset when it is recycled).
> 3. The next young/mixed collection will not reset the bitmap for region A because the `needs reset` flag is clear.
> 4. The collector will see stale mark bits for region A and will probably crash.

My understanding is: op_reset_after_collect is called at the end of a successful collection after the old region (A) is  repurposed as a young region, if so it is not an issue, I'll double confirm.

> src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp line 235:
> 
>> 233:   if (need_bitmap_reset()) {
>> 234:     if (heap->mode()->is_generational() && is_global() && !heap->young_generation()->need_bitmap_reset()) {
>> 235:       //Only need to reset bitmap for old generation.
> 
> I'd like to see an assert here that all the bitmaps for all the young regions are already clear.

I'll add it, thanks.

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

PR Comment: https://git.openjdk.org/shenandoah/pull/516#issuecomment-2420637408
PR Review Comment: https://git.openjdk.org/shenandoah/pull/516#discussion_r1805471619


More information about the shenandoah-dev mailing list