RFR: 8356667: GenShen: Eliminate races with ShenandoahFreeSet::available() [v2]
William Kemper
wkemper at openjdk.org
Mon May 12 23:31:54 UTC 2025
On Mon, 12 May 2025 23:22:33 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:
>> Two changes:
>>
>> 1. Compute the difference between capacity and used while holding the heap lock (so that these two values do not change in incompatible ways while the difference is being computed)
>> 2. Return a "harmless" Sentinel value in case available() is consulted while we are in the process of rebuilding the freeset. The SIZE_MAX value is considered harmless in that it will not cause immediate trigger of a new GC. In typical usage, the control or regulator thread will check available() again in another millisecond, at which time a more accurate accounting of available will be provided (if the freeset reconstruction has been completed).
>
> Kelvin Nilsen has updated the pull request incrementally with one additional commit since the last revision:
>
> Respond to reviewer comments
Changes requested by wkemper (Reviewer).
src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp line 234:
> 232: }
> 233:
> 234: // Acquire heap lock and return available_in, assuming heap lock is not acquired by the caller.
Sorry - can we change this comment too? This method does _not_ acquire the lock in release builds. Comment could mention that it acquires the lock only for the correctness of the assertion?
-------------
PR Review: https://git.openjdk.org/jdk/pull/25165#pullrequestreview-2834876929
PR Review Comment: https://git.openjdk.org/jdk/pull/25165#discussion_r2085680099
More information about the hotspot-gc-dev
mailing list