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 Tue, 6 Jan 2026 17:28:27 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> 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.

But part of the reason for my confusion is that you are trying to do fast allocations while holding the heap lock!

The reason we came into attempt_allocation_slow() is because we already failed to attempt_allocation_in_alloc_regions().  There's no need to call this a second time.  You should have remembered regions_ready_for_refresh and passed this in as an argument to attempt_allocation_slow().

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

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


More information about the hotspot-gc-dev mailing list