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

Xiaolong Peng xpeng at openjdk.org
Thu Jan 15 18:37:22 UTC 2026


On Tue, 8 Jul 2025 18:26:37 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 298 commits:
>> 
>>  - Merge branch 'master' into cas-alloc-1
>>  - More accurate census noise
>>  - Code format
>>  - typo
>>  - More eagerly to refresh alloc regions in attempt_allocation_slow since it is holding heap lock
>>  - While eagerly refresh alloc regions, thread should not yield to safepoint because it is holding uninitialized new object
>>  - Fix assert when after eagerly refresh alloc regions after fast allocation
>>  - Remove the support of 0 for flags ShenandoahMutatorAllocRegions and ShenandoahCollectorAllocRegions
>>  - Merge branch 'openjdk:master' into cas-alloc-1
>>  - Add virtual back for release_alloc_regions and reserve_alloc_regions to fix link error
>>  - ... and 288 more: https://git.openjdk.org/jdk/compare/624d7144...6de6789f
>
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 615:
> 
>> 613:         size_t capacity = _free_set->alloc_capacity(i);
>> 614:         bool is_empty = (capacity == _region_size_bytes);
>> 615:         // TODO remove assert, not possible to pass when allow mutator to allocate w/o lock.
> 
> Probably the preferred approach here is to "pre-retire" regions when they are made directly allocatable.  When the region is pre-retired, it is taken out of the partition, so assert_bounds no longer applies to this region.

The new impl always pre-retire when reserve a region from free set.

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

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


More information about the shenandoah-dev mailing list