From: Willy Tarreau Date: Tue, 11 Mar 2025 16:12:25 +0000 (+0100) Subject: MEDIUM: cpu-topo: use the "first-usable-node" cpu-policy by default X-Git-Tag: v3.2-dev8~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56d939866b8c7d6c551dd87c44333e8f3c7ac888;p=thirdparty%2Fhaproxy.git MEDIUM: cpu-topo: use the "first-usable-node" cpu-policy by default 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. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 6d3361eae..270e35d31 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -1999,6 +1999,7 @@ cpu-set ... - only-core do not bind to CPUs on other hardware core number - drop-thread do not bind to CPUs on this hardware thread number - only-thread do not bind to CPUs on other hardware thread number + See also: "cpu-policy" crt-base 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 diff --git a/src/cpu_topo.c b/src/cpu_topo.c index 966698c56..edb1708e3 100644 --- a/src/cpu_topo.c +++ b/src/cpu_topo.c @@ -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);