RFR: 8361099: Shenandoah: Improve heap lock contention by using CAS for memory allocation [v20]

Xiaolong Peng xpeng at openjdk.org
Mon Jan 12 20:55:18 UTC 2026


On Tue, 6 Jan 2026 21:11:20 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> Xiaolong Peng has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 265 commits:
>> 
>>  - Merge branch 'openjdk:master' into cas-alloc-1
>>  - Fix build error after merging from tip
>>  - Merge branch 'master' into cas-alloc-1
>>  - Merge branch 'master' into cas-alloc-1
>>  - Some comments updates as suggested in PR review
>>  - Fix build failure after merge
>>  - Expend promoted from ShenandoahOldCollectorAllocator
>>  - Merge branch 'master' into cas-alloc-1
>>  - Address PR comments
>>  - Merge branch 'openjdk:master' into cas-alloc-1
>>  - ... and 255 more: https://git.openjdk.org/jdk/compare/de81d389...cf13b7b5
>
> src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp line 167:
> 
>> 165: };
>> 166: 
>> 167: HeapWord* ShenandoahHeapRegion::allocate_atomic(size_t size, const ShenandoahAllocRequest& req, bool &ready_for_retire) {
> 
> Suggest we add a fourth arg: int &contended
> We initialize contended to zero

What do we want to track with the `contended` arg? If we want to track the number of threads allocating simultaneously from the same region or from same shared alloc region index, we can't archive either of them with the arg `&contended `.

Let's discuss this later, I need to understand the intention/idea before making this change.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26171#discussion_r2683872357


More information about the shenandoah-dev mailing list