lkml.org 
[lkml]   [2022]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v4 4/7] sched/fair: remove useless check in select_idle_core
On Sun, Jun 19, 2022 at 5:05 AM Abel Wu <wuyun.abel@bytedance.com> wrote:
>
> The function only gets called when sds->has_idle_cores is true which can
> be possible only when sched_smt_present is enabled.
>
> Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
> ---
> kernel/sched/fair.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index aba1dad19574..1cc86e76e38e 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6256,9 +6256,6 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu
> bool idle = true;
> int cpu;
>
> - if (!static_branch_likely(&sched_smt_present))
> - return __select_idle_cpu(core, p);
> -

The static branch is basically free; although you're right that we
currently don't take !smt_present branch direction here, it doesn't
seem harmful to leave this check in case assumptions change about when
we call select_idle_core().

> for_each_cpu(cpu, cpu_smt_mask(core)) {
> if (!available_idle_cpu(cpu)) {
> idle = false;
> --
> 2.31.1
>

\
 
 \ /
  Last update: 2022-06-28 01:45    [W:0.716 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site