]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: config: do not detect NUMA topology when cpu-map is configured
authorWilly Tarreau <w@1wt.eu>
Tue, 18 Jul 2023 15:45:21 +0000 (17:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 20 Jul 2023 09:01:09 +0000 (11:01 +0200)
As documented, the NUMA auto-detection is not supposed to be used when
the CPU affinity was set either by taskset (already checked) or by a
cpu-map directive. However this check was missing, so that configs
having cpu-map entries would still first bind to a single node. In
practice it has no impact on correct configs since bindings will be
replaced. However for those where the cpu-map directive are not
exhaustive it will have the impact of binding those threads to one node,
which disagrees with the doc (and makes future evolutions significantly
more complicated).

This could be backported to 2.4 where numa-cpu-mapping was added, though
if nobody encountered this by then maybe we should only focus on recent
versions that are more NUMA-friendly (e.g. 2.8 only). This patch depends
on this previous commit that brings the function we rely on:

   MINOR: cpuset: add cpu_map_configured() to know if a cpu-map was found

src/cfgparse.c

index a8d5f87fb51d83fdd37166d42c4f03ee3009f2be..bfcaba883267299decc88ec6c0954d38e6ffd05b 100644 (file)
@@ -2801,7 +2801,7 @@ int check_config_validity()
                {
                        int numa_cores = 0;
 #if defined(USE_CPU_AFFINITY)
-                       if (global.numa_cpu_mapping && !thread_cpu_mask_forced())
+                       if (global.numa_cpu_mapping && !thread_cpu_mask_forced() && !cpu_map_configured())
                                numa_cores = numa_detect_topology();
 #endif
                        global.nbthread = numa_cores ? numa_cores :