RFR: 8361099: Shenandoah: Improve heap lock contention by using CAS for memory allocation [v14]
Xiaolong Peng
xpeng at openjdk.org
Wed Dec 3 01:09:03 UTC 2025
On Tue, 2 Dec 2025 22:01:17 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:
>> src/hotspot/share/gc/shenandoah/shenandoahAllocator.cpp line 80:
>>
>>> 78: break;
>>> 79: case ShenandoahFreeSetPartitionId::OldCollector:
>>> 80: _free_set->recompute_total_used</* UsedByMutatorChanged */ true,
>>
>> These parameters seem overly conservative. Can we distinguish what needs to be recomputed?
>> Normally, OldCollector allocation does not change UsedByMutator or UsedByCollector. It will only change MutatorEmpties if we did flip_to_old. It will normally not changed OldCollectorEmpties (unless it flips multiple mutator to OldCollector. if might flip one region from mutator, but that region will not be empty after we allocate fro it...
>
> I suppose we could use conservative values for a first implementation, as long as we file a "low priority" ticket to come back and revisit for improved efficiency at a later time.
We don't really know what need to be recompute until the allocation finishes, we can make it less conservative, but then we needs more code branches here because the template methods require explicit template parameters.
I'll create to ticket to follow up on this, given that I also want to see if we can defer the recomputation to the read side, if we can do that we don't even need the ShenandoahHeapAccountingUpdater here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26171#discussion_r2583271726
More information about the shenandoah-dev
mailing list