RFR: 8371702: ZGC: NUMA-Affinity for Worker Threads in the Relocation Phase
Joel Sikström
jsikstro at openjdk.org
Wed Nov 12 10:59:34 UTC 2025
Hello,
The main goal of this PR is to solve a performance regression in relatively small environments on a NUMA machine. See the associated issue for a more detailed explanation on regression itself.
I propose we add functionality to set the affinity of worker threads in the Relocation Phase of ZGC so that the worker threads are *always* accessing NUMA-local memory when relocating objects. As soon as a worker threads is about to start relocating a new forwarding entry (or just page), it makes sure that it has the appropriate affinity set. At the most, each worker thread will set its own affinity the same number of times as there are NUMA nodes on the system. When the threads are about to exit the Relocation Phase (i.e. by completing `ZRelocateTask`), they "strip" their affinity so that they are allowed to run on any CPU that they were originally allowed to run on.
I've done significant performance testing, which solves the observed regression and gives an additional performance boost in the same environments. I have not been able to observe similar boosts in performance on much larger environments (>=70 CPUs and >32GB memory) and also no regressions.
-------------
Depends on: https://git.openjdk.org/jdk/pull/28261
Commit messages:
- 8371702: ZGC: NUMA-Affinity for Worker Threads in the Relocation Phase
Changes: https://git.openjdk.org/jdk/pull/28262/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28262&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8371702
Stats: 41 lines in 1 file changed: 19 ins; 13 del; 9 mod
Patch: https://git.openjdk.org/jdk/pull/28262.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28262/head:pull/28262
PR: https://git.openjdk.org/jdk/pull/28262
More information about the hotspot-gc-dev
mailing list