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

William Kemper wkemper at openjdk.org
Fri Oct 4 18:41:01 UTC 2024


On Fri, 4 Oct 2024 17:58:55 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> William Kemper has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix old gen usage of shFreeSet::log_status
>
> src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp line 184:
> 
>> 182:       // global soft refs policy, and we better report it every time heap
>> 183:       // usage goes down.
>> 184:       heap->update_capacity_and_used_at_gc();
> 
> This looks suspiciously like it needs to be under heap lock.  In the original code, it was.

Yes, I looked at this. These two fields are defined in `CollectedHeap` and reflect `committed` and `used` for Shenandoah. They are only updated by the control thread and they are only read without the heap lock by the control thread or the vm thread to adjust the soft reference policy. The risk would be that if `used` somehow exceeded `committed`, but we have many assertions through `ShenandoahGeneration` to assert that this doesn't happen.

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

PR Review Comment: https://git.openjdk.org/shenandoah-jdk21u/pull/113#discussion_r1788141477


More information about the shenandoah-dev mailing list