[jdk23u] RFR: 8334147: Shenandoah: Avoid taking lock for disabled free set logging [v2]

William Kemper wkemper at openjdk.org
Tue Oct 8 20:44:03 UTC 2024


On Tue, 8 Oct 2024 18:04:29 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:

>> William Kemper has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8341554: Shenandoah: Missing heap lock when updating usage for soft ref policy
>>   
>>   Reviewed-by: kdnilsen, ysr
>
> src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp line 186:
> 
>> 184:         ShenandoahHeapLocker locker(heap->lock());
>> 185:         heap->update_capacity_and_used_at_gc();
>> 186:       }
> 
> Backport of changes look sgood, but highlights the lock-unlock-lock-unlock awkwardness. I suppose the mitigating factor is that in most cases the first one doesn't usually lock because free set log status is hopefully disabled in most production scenarios.

Yes, lock/unlock is not ideal when freeset logging is enabled. However, this arrangement make it clear that `update_capacity_and_used_at_gc` needs the lock separately.

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

PR Review Comment: https://git.openjdk.org/jdk23u/pull/129#discussion_r1792476856


More information about the jdk-updates-dev mailing list