Integrated: 8374686: ZGC: Convert zMarkTerminate to use Atomic<T>
Axel Boldt-Christmas
aboldtch at openjdk.org
Tue Jan 27 08:29:26 UTC 2026
On Thu, 15 Jan 2026 06:46:10 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
> Convert usages of AtomicAccess to Atomic<T> in zMarkTerminate.
>
> There are a few things that potentially should be changed here.
>
> First the `_nworkers` variable was accessed through the AtomicAccess API in a handful of places. In this patch I changed it to always be an Atomic. However, this variable is only ever read concurrently. It only gets modified before we schedule a task on the workers (either for a new task, or after all workers have stopped working because we are resizing the work gang size). So potentially this could just be changed to a uint with plain loads and stores.
>
> The other variables have mutual exclusion when updated, but are read concurrently without synchronisation. In this patch I changed the volatile load + sub/add + atomic relaxed store [+ volatile load] into a simple atomic relaxed add/sub [and fetch]. The main reason being that I thought the code became less verbose, easier to read and understand.
>
> Testing:
> * GHA
> * HotSpot GC tests with ZGC linux x64 and linux aarch64
This pull request has now been integrated.
Changeset: 5c05d6f2
Author: Axel Boldt-Christmas <aboldtch at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/5c05d6f230e34cf409529d87b71f768a384ae4b4
Stats: 29 lines in 2 files changed: 1 ins; 3 del; 25 mod
8374686: ZGC: Convert zMarkTerminate to use Atomic<T>
Reviewed-by: stefank, kbarrett
-------------
PR: https://git.openjdk.org/jdk/pull/29246
More information about the hotspot-gc-dev
mailing list