libnuma provides an API through numa_sched_setaffinity to set the affinity of threads to run on certain CPUs. By figuring out what CPUs are associated with specific NUMA nodes, you can use numa_sched_setaffinity to set the affinity of a thread to only run on CPUs belonging to that NUMA node. This approach must also consider that the user might restrict what NUMA nodes and CPUs the JVM process is allowed to run on when it starts (influenced by numactl for example), since using numa_sched_setaffinity might override such configuration. Much of the functionality to easily implement this is limited to libnuma v2.
- links to
-
Commit(master)
openjdk/jdk/0a963b61
-
Review(master)
openjdk/jdk/28261