RFR: 8372684: G1: Missing load_acquire() in G1 allocation path
Kim Barrett
kbarrett at openjdk.org
Fri Nov 28 09:15:50 UTC 2025
On Thu, 27 Nov 2025 18:48:53 GMT, Thomas Schatzl <tschatzl 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.
-------------
Marked as reviewed by kbarrett (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28543#pullrequestreview-3518065240
More information about the hotspot-gc-dev
mailing list