RFR: 8361099: Shenandoah: Improve heap lock contention by using CAS for memory allocation [v20]
Xiaolong Peng
xpeng at openjdk.org
Sat Jan 10 06:19:21 UTC 2026
On Fri, 9 Jan 2026 19:57:23 GMT, Xiaolong Peng <xpeng at openjdk.org> wrote:
>> I don't have concern to move it to ShenandoahThreadLocalData, the benefit of using THREAD_LOCAL is just better cohesive code because _alloc_start_index is defined in the same namespace where it is used. Performance wise, I don't think there is much benefits.
>>
>> I do see ZGC also use THREAD_LOCAL directly, I guess the overhead on all threads is not a huge concern.
>> But given Shenandoah has ShenandoahThreadLocalData to manage all the thread locals, it make sense to not use THREAD_LOCAL directly, I'll update the PR to move _alloc_start_index to ShenandoahThreadLocalData.
>
> While I am trying to use ShenandoahThreadLocalData, I realized that I need to add 2 alloc start index, one for ShenandoahMutatorAllocator, one for ShenandoahCollectorAllocator. Later when I update ShenandoahOldCollectorAllocator to use CAS allocation, one more will be added.
I have moved all the THREAD_LOCAL to ShenandoahThreadLocalData, also rewrote `alloc_start_index` function in templated impl to avoid virtual table lookup.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26171#discussion_r2678364578
More information about the shenandoah-dev
mailing list