RFR: 8372684: G1: Missing load_acquire() in G1 allocation path
Thomas Schatzl
tschatzl at openjdk.org
Fri Nov 28 08:33:14 UTC 2025
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
-------------
Commit messages:
- 8372684
Changes: https://git.openjdk.org/jdk/pull/28543/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28543&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8372684
Stats: 50 lines in 3 files changed: 6 ins; 3 del; 41 mod
Patch: https://git.openjdk.org/jdk/pull/28543.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28543/head:pull/28543
PR: https://git.openjdk.org/jdk/pull/28543
More information about the hotspot-gc-dev
mailing list