]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: cpu-topo: use the "first-usable-node" cpu-policy by default
authorWilly Tarreau <w@1wt.eu>
Tue, 11 Mar 2025 16:12:25 +0000 (17:12 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Mar 2025 17:33:16 +0000 (18:33 +0100)
This now turns the cpu-policy to "first-usable-node" by default, so that
we preserve the current default behavior consisting in binding to the
first node if nothing was forced. If a second node is found,
global.nbthread is set and the previous code will be skipped.

doc/configuration.txt
src/cpu_topo.c

index 6d3361eae4d5fd87066b8400687f56c523c43b5b..270e35d311a38b02c42a1b08fc0989af9ebefd5c 100644 (file)
@@ -1999,6 +1999,7 @@ cpu-set <directive>...
     - only-core <set>    do not bind to CPUs on other hardware core number
     - drop-thread <set>  do not bind to CPUs on this hardware thread number
     - only-thread <set>  do not bind to CPUs on other hardware thread number
+  See also: "cpu-policy"
 
 crt-base <dir>
   Assigns a default directory to fetch SSL certificates from when a relative
@@ -2551,16 +2552,18 @@ no-quic
   processed by haproxy. See also "quic_enabled" sample fetch.
 
 numa-cpu-mapping
-  If running on a NUMA-aware platform, HAProxy inspects on startup the CPU
+  When running on a NUMA-aware platform with the cpu-policy is set to
+  "first-usable-node" (the default one), HAProxy inspects on startup the CPU
   topology of the machine. If a multi-socket machine is detected, the affinity
   is automatically calculated to run on the CPUs of a single node. This is done
   in order to not suffer from the performance penalties caused by the
   inter-socket bus latency. However, if the applied binding is non optimal on a
   particular architecture, it can be disabled with the statement 'no
   numa-cpu-mapping'. This automatic binding is also not applied if a nbthread
-  statement is present in the configuration, or the affinity of the process is
+  statement is present in the configuration, if the affinity of the process is
   already specified, for example via the 'cpu-map' directive or the taskset
-  utility.
+  utility, or if the cpu-policy is set to any other value. See also "cpu-map",
+  "cpu-policy", "cpu-set".
 
 ocsp-update.disable [ on | off ]
   Disable completely the ocsp-update in HAProxy. Any ocsp-update configuration
index 966698c56b4b175779924a89f7c2929d34340b38..edb1708e3780e7d3951cb1c06e56e44553032536 100644 (file)
@@ -48,7 +48,7 @@ struct cpu_set_cfg {
 } cpu_set_cfg;
 
 /* CPU policy choice */
-static int cpu_policy = 0;
+static int cpu_policy = 1; // "first-usable-node"
 
 /* list of CPU policies for "cpu-policy". The default one is the first one. */
 static int cpu_policy_first_usable_node(int policy, int tmin, int tmax, int gmin, int gmax, char **err);