Integrated: 8372684: G1: Missing load_acquire() in G1 allocation path

Thomas Schatzl tschatzl at openjdk.org
Mon Dec 1 08:09:05 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

This pull request has now been integrated.

Changeset: ef5e744a
Author:    Thomas Schatzl <tschatzl at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ef5e744a8136c3d983bdf8721a84fd1488b3c7a8
Stats:     50 lines in 3 files changed: 6 ins; 3 del; 41 mod

8372684: G1: Missing load_acquire() in G1 allocation path

Reviewed-by: kbarrett, sjohanss

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

PR: https://git.openjdk.org/jdk/pull/28543


More information about the hotspot-gc-dev mailing list