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

Kelvin Nilsen kdnilsen at openjdk.org
Wed Jan 7 00:36:21 UTC 2026


On Wed, 3 Dec 2025 01:15:03 GMT, Xiaolong Peng <xpeng at openjdk.org> wrote:

>> It is not an error, before calling into attempt_allocation_slow, it already called attempt_allocation_in_alloc_regions once and failed to allocate, slow path is always with heap lock.
>> 
>> After taking the lock, we should try the attempt_allocation_in_alloc_regions right away, because other mutator thread may have refreshed the alloc regions while holding the lock.
>
> accounting_update is required for slow path, but you are right, it can be moved to somewhere later, e.g. line 128.

My mistake on first read here.  I see now that we only come into this function if fast-allocation failed.

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

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


More information about the hotspot-gc-dev mailing list