MINOR: cpuset: try to detect offline cpus at boot

When possible, the offline CPUs are detected at boot and their OFFLINE
flag is set in the ha_cpu_topo[] array. When the detection is not
possible (e.g. not linux, /sys not mounted etc), we just mark none of
them as being offline, as we don't want to infer wrong info that could
hinder automatic CPU placement detection.
This commit is contained in:
Willy Tarreau 2023-07-11 18:33:42 +02:00
parent fb2311518f
commit ef5d4ab8da

View File

@ -249,6 +249,17 @@ int cpu_detect_usable(void)
if (!ha_cpuset_isset(&boot_set, cpu))
ha_cpu_topo[cpu].st |= HA_CPU_F_EXCLUDED;
/* Update the list of currently offline CPUs. Normally it's a subset
* of the unbound ones, but we cannot infer anything if we don't have
* the info so we only update what we know.
*/
if (ha_cpuset_detect_online(&boot_set)) {
for (cpu = 0; cpu < maxcpus; cpu++) {
if (!ha_cpuset_isset(&boot_set, cpu))
ha_cpu_topo[cpu].st |= HA_CPU_F_OFFLINE;
}
}
return 0;
}