[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKfTPtDN0X3eern3DDj9JVh10YJ=YX9OHW0HYJscoi+P-4_v4w@mail.gmail.com>
Date: Thu, 11 Jan 2024 09:52:53 +0100
From: Vincent Guittot <vincent.guittot@...aro.org>
To: Keisuke Nishimura <keisuke.nishimura@...ia.fr>
Cc: Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>, linux-kernel@...r.kernel.org,
Dietmar Eggemann <dietmar.eggemann@....com>, Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>, Julia Lawall <julia.lawall@...ia.fr>,
Xunlei Pang <xlpang@...ux.alibaba.com>, Abel Wu <wuyun.abel@...edance.com>
Subject: Re: [PATCH v2 1/2 RESEND] sched/fair: take into account scheduling
domain in select_idle_smt()
On Wed, 10 Jan 2024 at 18:57, Keisuke Nishimura
<keisuke.nishimura@...ia.fr> wrote:
>
> >>
> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> >> index 533547e3c90a..66457d4b8965 100644
> >> --- a/kernel/sched/fair.c
> >> +++ b/kernel/sched/fair.c
> >> @@ -7311,13 +7311,19 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu
> >> /*
> >> * Scan the local SMT mask for idle CPUs.
> >> */
> >> -static int select_idle_smt(struct task_struct *p, int target)
> >> +static int select_idle_smt(struct task_struct *p, struct sched_domain *sd, int target)
> >> {
> >> int cpu;
> >>
> >> for_each_cpu_and(cpu, cpu_smt_mask(target), p->cpus_ptr) {
> >> if (cpu == target)
> >> continue;
> >> + /*
> >> + * Check if the CPU is in the LLC scheduling domain of @target.
> >> + * Due to isolcpus, there is no guarantee that all the siblings are in the domain.
> >> + */
> >> + if (!cpumask_test_cpu(cpu, sched_domain_span(sd)))
> >
> > commit df3cb4ea1fb6 ("sched/fair: Fix wrong cpu selecting from isolated domain")
> > also checked if (!cpumask_test_cpu(cpu, p->cpus_ptr) ||
> >
> > Why didn't you also re-add this test ?
> >
> >
>
> Thank you for your comment. This is because the iterator "for_each_cpu_and(cpu,
> cpu_smt_mask(target), p->cpus_ptr)" ensures that cpu is included in p->cpus_ptr.
Ah yes indeed. I didn't notice that it was now included in the for_each_cpu_and
Reviewed-by: Vincent Guittot <vincent.guittot@...aro.org>
>
> The iterator has changed. FYI, here is the change made in commit df3cb4ea1fb6:
>
> for_each_cpu(cpu, cpu_smt_mask(target)) {
> - if (!cpumask_test_cpu(cpu, p->cpus_ptr))
> + if (!cpumask_test_cpu(cpu, p->cpus_ptr) ||
> + !cpumask_test_cpu(cpu, sched_domain_span(sd)))
> continue;
> if (available_idle_cpu(cpu) || sched_idle_cpu(cpu))
>
> best,
> Keisuke
>
Powered by blists - more mailing lists