RFR: 8369048: GenShen: Defer ShenFreeSet::available() during rebuild [v3]
Y. Srinivas Ramakrishna
ysr at openjdk.org
Sat Nov 15 00:22:16 UTC 2025
On Thu, 13 Nov 2025 18:12:38 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:
>> This code introduces a new rebuild-freeset lock for purposes of coordinating the freeset rebuild activities and queries as to memory available for allocation in the mutator partition.
>>
>> This addresses a problem that results if available memory is probed while we are rebuilding the freeset.
>>
>> Rather than using the existing global heap lock to synchronize these activities, a new more narrowly scoped lock is introduced. This allows the available memory to be probed even when other activities hold the global heap lock for reasons other than rebuilding the freeset, such as when they are allocating memory. It is known that the global heap lock is heavily contended for certain workloads, and using this new lock avoids adding to contention for the global heap lock.
>
> Kelvin Nilsen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 17 commits:
>
> - Merge remote-tracking branch 'jdk/master' into synchronize-available-with-rebuild
> - update comment
> - Add documentation for _rebuild_lock
> - Hide rebuild_lock inside prepare_to_rebuild and finish_rebuild
> - Rename rebuild_lock()
> - Tighten up context for holding rebuild_lock
> - Remove ShenandoahFreeSet::FreeSetUnderConstruction sentinel value
> - Revert "revert introduction of RebuildLock"
>
> This reverts commit bec73da1dc169d391e9919203e5a406ea02a699c.
> - Revert "available() returns previous value if called during freeset rebuild"
>
> This reverts commit 1a5e483a4abb04b6045175e8bd4b0c11fa68cb73.
> - Revert "remove obsolete assertion"
>
> This reverts commit 717e7da17f03f1e52008d154fafcbbfc5f2bb20e.
> - ... and 7 more: https://git.openjdk.org/jdk/compare/bfc048ab...8462a290
src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp line 790:
> 788: inline size_t available() {
> 789: shenandoah_assert_not_heaplocked();
> 790: ShenandoahRebuildLocker locker(rebuild_lock());
May be motivate in a brief comment why we need the rebuild lock in this API, but not around the other APIs such as capacity() and used()?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27612#discussion_r2529307229
More information about the hotspot-gc-dev
mailing list