mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* has_idle_core
@ 2025-06-15 20:26 Julia Lawall
  2025-06-16 12:33 ` has_idle_core Vincent Guittot
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2025-06-15 20:26 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Vincent Guittot, Dietmar Eggemann,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: has_idle_core
  2025-06-15 20:26 has_idle_core Julia Lawall
@ 2025-06-16 12:33 ` Vincent Guittot
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent Guittot @ 2025-06-16 12:33 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Ingo Molnar, Peter Zijlstra, Dietmar Eggemann, linux-kernel

On Sun, 15 Jun 2025 at 22:26, Julia Lawall <julia.lawall@inria.fr> wrote:
>
> 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?

Yes, you're right. Now this is probably mitigated by the fact that it
still tries to find an idle cpu and load balance tries to spread tasks
on core

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-16 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-15 20:26 has_idle_core Julia Lawall
2025-06-16 12:33 ` has_idle_core Vincent Guittot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®