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

Xiaolong Peng xpeng at openjdk.org
Wed Jan 7 23:19:28 UTC 2026


On Tue, 6 Jan 2026 01:55:58 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/shenandoahAllocator.cpp line 338:
> 
>> 336:   for (uint i = 0; i < _alloc_region_count; i++) {
>> 337:     ShenandoahAllocRegion& alloc_region = _alloc_regions[i];
>> 338:     ShenandoahHeapRegion* r = AtomicAccess::load(&alloc_region.address);
> 
> We've got heap lock and at safepoint.  Do not need AtomicAccess here.  That is more costly than necessary.  I prefer to use regular fetch.  If you prefer to keep AtomicAccess, please provide a comment in the code explaining why and we will revist.

The atomic load is not needed, I'll removed.

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

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


More information about the hotspot-gc-dev mailing list