]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: thread: now remove the temporary CPU node binding code
authorWilly Tarreau <w@1wt.eu>
Tue, 11 Mar 2025 16:14:03 +0000 (17:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Mar 2025 17:33:16 +0000 (18:33 +0100)
This is now superseded by the default "safe" cpu-policy, and every time
it's used, that code was bypassed anyway since global.nbthread was set.
We can now safely remove it. Note that for other policies which do not
set a thread count nor further restrict CPUs (such as "none", or even
"safe" when finding a single node), we continue to go through the fallback
code that automatically assigns CPUs to threads and counts them.

src/thread.c

index 57925b989c998f4e8e7bb0a2dd9647ee53818509..5a2257d089f8ee23e99549c82e269931c6c0fdd1 100644 (file)
@@ -1622,43 +1622,6 @@ void thread_detect_count(void)
                return;
        }
 
-       /* Let's implement here the automatic binding to the first available
-        * NUMA node when thread count is not set, taskset is not used and
-        * no cpu-map directive is present.
-        */
-
-       if (global.numa_cpu_mapping && !global.nbthread && !cpu_mask_forced && !cpu_map_configured()) {
-               int first_node_id = -1;
-               int second_node_id = -1;
-               int cpu_count = 0;
-
-               /* determine first node with usable CPUs */
-               for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
-                       if (ha_cpu_topo[cpu].st & HA_CPU_F_EXCL_MASK)
-                               continue;
-
-                       if (ha_cpu_topo[cpu].no_id >= 0) {
-                               if (first_node_id < 0)
-                                       first_node_id = ha_cpu_topo[cpu].no_id;
-                               else {
-                                       second_node_id = ha_cpu_topo[cpu].no_id;
-                                       break;
-                               }
-                       }
-               }
-
-               if (second_node_id >= 0) {
-                       /* ignore all CPUs of other nodes, and count them */
-                       for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
-                               if (ha_cpu_topo[cpu].no_id != first_node_id)
-                                       ha_cpu_topo[cpu].st |= HA_CPU_F_IGNORED;
-                               else if (!(ha_cpu_topo[cpu].st & HA_CPU_F_EXCL_MASK))
-                                       cpu_count++;
-                       }
-                       ha_diag_warning("Multi-socket cpu detected, automatically binding on active CPUs of '%d' (%u active cpu(s))\n", first_node_id, cpu_count);
-               }
-       }
-
        if (!ha_cpuset_count(&cpu_map[0].thread[0])) {
                /* thread 1 is not mapped, no policy was applied, so we have to
                 * count the threads ourselves.