has_idle_core

From: Julia Lawall
Date: Sun Jun 15 2025 - 16:27:41 EST


Hello,

I wonder about the following code in select_idle_cpu:

for_each_cpu_wrap(cpu, cpus, target + 1) {
if (has_idle_core) {
i = select_idle_core(p, cpu, cpus, &idle_cpu);
if ((unsigned int)i < nr_cpumask_bits)
return i;

} else {
if (--nr <= 0)
return -1;
idle_cpu = __select_idle_cpu(cpu, p);
if ((unsigned int)idle_cpu < nr_cpumask_bits)
break;
}
}

if (has_idle_core)
set_idle_cores(target, false);

set/test_idle_cores works at the LLC level. But the mask cpus in
for_each_cpu_wrap depends on the set of cores on which the task to be
placed can run. So can't the placement of one task that is pinned to a
small set of busy cores prevent the search for an idle core for subsequent
less restricted waking tasks, until the idle cores flag is reset?

For the moment, this is a purely theoretical question. I don't have a
concrete example that illustrates the problem.

thanks,
julia