RFR: 8371702: ZGC: NUMA-Affinity for Worker Threads in the Relocation Phase [v2]

Joel Sikström jsikstro at openjdk.org
Wed Nov 12 12:51:04 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.

Joel Sikström has updated the pull request incrementally with one additional commit since the last revision:

  Comment fixes

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28262/files
  - new: https://git.openjdk.org/jdk/pull/28262/files/2aabc2fb..fea63eca

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28262&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28262&range=00-01

  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 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