-----Original Message----- From: tiantao (H) Sent: Tuesday, March 23, 2021 3:19 PM To: Song Bao Hua (Barry Song) song.bao.hua@hisilicon.com Cc: linuxarm@openeuler.org; tiantao (H) tiantao6@hisilicon.com 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.
Signed-off-by: Tian Tao tiantao6@hisilicon.com
Hi Tao, Thanks! Looks correct to me. Let's send it to maillist to get feedback, perhaps Mel Gorman will have some comments, like completely removing the function.
Better to put some words below "---" to say this patch is addressing the comment of Mel Gorman in the below thread so that people can understand the background better: https://lore.kernel.org/lkml/20210322101556.GK15768@suse.de/
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)
} } rcu_read_unlock();idle_core = numa_idle_core(idle_core, cpu);
-- 2.7.4
Thanks Barry