]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cpu-topo: cpu_dump_topology() SMT info check little optimisation
authorDavid Carlier <devnexen@gmail.com>
Wed, 2 Apr 2025 06:00:44 +0000 (07:00 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 2 Apr 2025 09:31:37 +0000 (11:31 +0200)
Once we stumble across the first cpu having the criteria, we exit
earlier from the loop.

src/cpu_topo.c

index 48837b1db0ab96e632ccf0fa340fcb5a1eae86d0..0416d69db007bdbec4444c01d6f5b307479a9aca 100644 (file)
@@ -219,9 +219,12 @@ void cpu_dump_topology(const struct ha_cpu_topo *topo)
        int cpu, lvl;
        int grp, thr;
 
-       for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++)
-               if (ha_cpu_topo[cpu].th_cnt > 1)
+       for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
+               if (ha_cpu_topo[cpu].th_cnt > 1) {
                        has_smt = 1;
+                       break;
+               }
+       }
 
        for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
                if (ha_cpu_topo[cpu].st & HA_CPU_F_OFFLINE)