RFR: 8361099: Shenandoah: Improve heap lock contention by using CAS for memory allocation [v5]
Xiaolong Peng
xpeng at openjdk.org
Fri Nov 7 19:48:13 UTC 2025
On Wed, 5 Nov 2025 19:02:59 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 135 commits:
>>
>> - Merge branch 'openjdk:master' into cas-alloc-1
>> - Merge branch 'openjdk:master' into cas-alloc-1
>> - format
>> - Merge branch 'openjdk:master' into cas-alloc-1
>> - Merge branch 'openjdk:master' into cas-alloc-1
>> - Merge branch 'master' into cas-alloc-1
>> - Move ShenandoahHeapRegionIterationClosure to shenandoahFreeSet.hpp
>> - Merge branch 'openjdk:master' into cas-alloc-1
>> - Fix errors caused by renaming ofAtomic to AtomicAccess
>> - Merge branch 'openjdk:master' into cas-alloc-1
>> - ... and 125 more: https://git.openjdk.org/jdk/compare/2f613911...e6bfef05
>
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 1268:
>
>> 1266: // If region is not completely free, the current [beg; end] is useless, and we may fast-forward. If we can extend
>> 1267: // the existing range, we can exploit that certain regions are already known to be in the Mutator free set.
>> 1268: ShenandoahHeapRegion* region = _heap->get_region(end);
>
> Here also, if we remove the region from the partition when we make it directly allocatable, we would not need to rewrite this loop.
Yes, same as your comment above.
Mutator thread shouldn't see any region which has been made directly allocatable in the Mutator partition here.
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 2204:
>
>> 2202: i++;
>> 2203: }
>> 2204: return obj;
>
> I think obj always equals nullptr at this point. Seems the code would be easier to understand (and would depend less on effective compiler optimization) if we just made that explicit. Can we just say:
>
> return nullptr?
Yes, it is always `nullptr`, `return nullptr` will make the code more readable.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26171#discussion_r2505212589
PR Review Comment: https://git.openjdk.org/jdk/pull/26171#discussion_r2505221448
More information about the hotspot-gc-dev
mailing list