RFR: 8338737: Shenandoah: Reset marking bitmaps after the cycle [v3]

Xiaolong Peng xpeng at openjdk.org
Thu Jan 9 19:40:45 UTC 2025


On Wed, 8 Jan 2025 21:38:16 GMT, Xiaolong Peng <xpeng at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp line 592:
>> 
>>> 590:   // If it is old GC bootstrap cycle, always clear bitmap for global gen
>>> 591:   // to ensure bitmap for old gen is clear for old GC cycle after this.
>>> 592:   if (_do_old_gc_bootstrap) {
>> 
>> This may deserve a comment.  It seems we ought to clear the old-gen mark bitmap at the end of coalesce-and-fill.  But that does not allow us to avoid clearing old-gen mark bitmaps at start of bootstrap because when young-gen regions are promoted in place, the mark bitmap is preserved for those regions, and since they are considered old at the end of the GC cycle during which they were promoted, those bitmaps will not be cleared by op_reset_after_collect().  Is there a way to improve this behavior?
>> 
>> For example, in op_reset_after_collect(), maybe we should clear old-gen bitmaps also (at least for recently promoted in place regions) unless old marking is in process and/or mixed evacuations are in progress.
>> 
>> Maybe this can be tackled in a separate PR, but would be good to file JBS ticket now if there is agreement on the approach.
>
> Yes, We can reset bimap of old region when there in place promotion and all old regions after coalesce-and-fill for old gen. 
> 
> Thanks Kelvin, I'll create a JBS ticket for this.

This is ShenandoahConcurrentGC::op_reset(), it is executed when a cycle starts. I have removed line 361 to 371, which traverse all regions and apply reset for old regions when `_do_old_gc_bootstrap` is true, so it used to iterate regions twice when `_do_old_gc_bootstrap` is true. With this change, it only iterate once and reset bitmap for all regions when `_do_old_gc_bootstrap` is true.

Here is the ticket https://bugs.openjdk.org/browse/JDK-8347372 to follow up the possible improvements on old GC.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22778#discussion_r1909344212


More information about the hotspot-gc-dev mailing list