[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1616833161-64375-1-git-send-email-tiantao6@hisilicon.com>
Date: Sat, 27 Mar 2021 16:19:21 +0800
From: Tian Tao <tiantao6@...ilicon.com>
To: <mingo@...hat.com>, <peterz@...radead.org>,
<juri.lelli@...hat.com>, <vincent.guittot@...aro.org>,
<song.bao.hua@...ilicon.com>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH] sched/fair: Remove the redundant check in numa_id_core
the numa_idle_core() function have a little redundant. then this patch
move the "idle_core >= 0" check in numa_idle_core() to its caller in
update_numa_stats() and then remove the redundant check in
!static_branch_likely(&sched_smt_present) check in numa_idle_core.
This patch is based on the following discussion:
https://lore.kernel.org/lkml/20210322101556.GK15768@suse.de/
Signed-off-by: Tian Tao <tiantao6@...ilicon.com>
---
kernel/sched/fair.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6d73bdbb..fbff7f1 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1569,8 +1569,7 @@ numa_type numa_classify(unsigned int imbalance_pct,
static inline bool test_idle_cores(int cpu, bool def);
static inline int numa_idle_core(int idle_core, int cpu)
{
- if (!static_branch_likely(&sched_smt_present) ||
- idle_core >= 0 || !test_idle_cores(cpu, false))
+ if (!test_idle_cores(cpu, false))
return idle_core;
/*
@@ -1622,7 +1621,8 @@ static void update_numa_stats(struct task_numa_env *env,
if (ns->idle_cpu == -1)
ns->idle_cpu = cpu;
- idle_core = numa_idle_core(idle_core, cpu);
+ if (idle_core >= 0)
+ idle_core = numa_idle_core(idle_core, cpu);
}
}
rcu_read_unlock();
--
2.7.4
Powered by blists - more mailing lists