[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKfTPtCVVnhb7S=iC3vmfJbPj9Ug+W33pw6VuFO6De0FcTuNQA@mail.gmail.com>
Date: Wed, 21 Jun 2023 10:30:14 +0200
From: Vincent Guittot <vincent.guittot@...aro.org>
To: Miaohe Lin <linmiaohe@...wei.com>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched/fair: fix returning possible non-optimal candidate
On Wed, 21 Jun 2023 at 09:16, Miaohe Lin <linmiaohe@...wei.com> wrote:
>
> In best_fits < 0 case, best_thermal_cap > prev_thermal_cap is checked to
> determine whether best_energy_cpu should be returned. But prev_fits can
> be > 0 in this case and it should be preferred.
IIRC, (best_thermal_cap > prev_thermal_cap) makes the condition
(prev_fits < 0) useless
Do you have a use case where
(best_fits < 0)
&& (prev_fits > 0)
&& (best_thermal_cap > prev_thermal_cap)
?
>
> Fixes: e5ed0550c04c ("sched/fair: unlink misfit task from cpu overutilized")
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 28ff831ee847..a4e300fc44be 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7684,7 +7684,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
>
> if ((best_fits > prev_fits) ||
> ((best_fits > 0) && (best_delta < prev_delta)) ||
> - ((best_fits < 0) && (best_thermal_cap > prev_thermal_cap)))
> + ((best_fits < 0) && (prev_fits < 0) && (best_thermal_cap > prev_thermal_cap)))
> target = best_energy_cpu;
>
> return target;
> --
> 2.27.0
>
Powered by blists - more mailing lists