RFR: 8372684: G1: Missing load_acquire() in G1 allocation path
Thomas Schatzl
tschatzl at openjdk.org
Mon Dec 1 08:09:03 UTC 2025
On Fri, 28 Nov 2025 09:13:32 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Hi all,
>>
>> please review this change that changes some volatile atomics to the new `Atomic` construct, fixing some issue with missing load_acquire when allocating in `G1HeapRegion::par_allocate()`.
>>
>> That `load_acquire` seems necessary as when setting a new allocation region, there needs to be synchronization about the contents (top/end) of the heap region. Otherwise the allocating thread might get old/previous top values sent from the corresponding storestore (I changed to a `release_store()` in `G1AllocRegion::update_alloc_region()`.
>>
>> Similar issue exists in the handling of the retained regions.
>>
>> I also made the `G1AllocatorRegion::_dummy_region` Atomic; synchronization is necessary for a single `release_store` at initialization. No further synchronization is necessary (just using relaxed loads) as its contents are never changed afterwards.
>>
>> Performance testing, both manually on targeted benchmarks and a few general ones without differences.
>>
>> Testing: gha, tier1-3
>>
>> Thanks,
>> Thomas
>
> Looks good.
Thanks @kimbarrett @kstefanj for your reviews
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28543#issuecomment-3595152537
More information about the hotspot-gc-dev
mailing list