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.
Signed-off-by: Tian Tao tiantao6@hisilicon.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 afb895a3..bae974a 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();