]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cpu-topo: also store the sibling ID with SMT
authorWilly Tarreau <w@1wt.eu>
Wed, 8 Jan 2025 16:55:10 +0000 (17:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Mar 2025 17:30:30 +0000 (18:30 +0100)
The sibling ID was not reported because it's not directly accessible
but we don't care, what matters is that we assign numbers to all the
threads we find using the same CPU so that some strategies permit to
allocate one thread at a time if we want to use few threads with max
performance.

src/cpu_topo.c

index 9166c1195b9a95c2d6e74f414b5a18e0740b013b..b1a131021dc3970314777abb7553c35f164aff8f 100644 (file)
@@ -298,11 +298,14 @@ int cpu_detect_topology(void)
                        parse_cpu_set_args[0] = trash.area;
                        parse_cpu_set_args[1] = "\0";
                        if (parse_cpu_set(parse_cpu_set_args, &cpus_list, NULL) == 0) {
+                               int sib_id = 0;
+
                                cpu_id.th_cnt = ha_cpuset_count(&cpus_list);
                                for (cpu2 = 0; cpu2 <= cpu_topo_lastcpu; cpu2++) {
                                        if (ha_cpuset_isset(&cpus_list, cpu2)) {
                                                ha_cpu_topo[cpu2].ts_id  = cpu_id.ts_id;
                                                ha_cpu_topo[cpu2].th_cnt = cpu_id.th_cnt;
+                                               ha_cpu_topo[cpu2].th_id  = sib_id++;
                                        }
                                }
                                cpu_id.ts_id++;