RFR: 8369048: GenShen: Defer ShenFreeSet::available() during rebuild
Kelvin Nilsen
kdnilsen at openjdk.org
Tue Nov 11 22:12:05 UTC 2025
On Fri, 31 Oct 2025 00:36:57 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:
>> src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp line 1158:
>>
>>> 1156: size_t young_cset_regions, old_cset_regions, first_old, last_old, num_old;
>>> 1157: ShenandoahFreeSet* free_set = heap->free_set();
>>> 1158: ShenandoahRebuildLocker rebuild_locker(free_set->lock());
>>
>> Should you not create a scope around lines 1158 to line 1167, since you don't want to hold the rebuild lock as soon as the rebuild is done (i.e. immediately following `finish_rebuild()`)?
>
> May be it doesn't matter, since no one else is running during a full gc who needs to query `available()`?
I'll tighten up the context for the rebuild lock. I was thinking that set_mark_incomplete() and clear_cancelled_gc() would be "fast enough" that it wouldn't matter to hold the rebuild_lock this much longer, but I agree it is better to release the lock as soon as possible.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27612#discussion_r2515969801
More information about the hotspot-gc-dev
mailing list