From 67c99db0a7e4d6e9874cc76843778f790c9467dd Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 18 Jul 2023 17:45:21 +0200 Subject: [PATCH] BUG/MINOR: config: do not detect NUMA topology when cpu-map is configured 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cfgparse.c b/src/cfgparse.c index a8d5f87fb..bfcaba883 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -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 :