[PATCH 1/2] sched/numa: don't migrate task if cookie not match

From: Aubrey Li
Date: Thu Nov 07 2019 - 01:51:28 EST


For the NUMA load balance, don't migrate task to the CPU whose core
cookie does not match with task's cookie

Signed-off-by: Aubrey Li <aubrey.li@xxxxxxxxxxxxxxx>
---
kernel/sched/fair.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3aec68a..2909030 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1827,6 +1827,16 @@ static void task_numa_find_cpu(struct task_numa_env *env,
if (!cpumask_test_cpu(cpu, env->p->cpus_ptr))
continue;

+#ifdef CONFIG_SCHED_CORE
+ /*
+ * Skip this cpu if source task's cookie does not match
+ * with CPU's core cookie.
+ */
+ if (sched_core_enabled(cpu_rq(cpu)) && (env->p->core_cookie !=
+ cpu_rq(cpu)->core->core_cookie))
+ continue;
+#endif
+
env->dst_cpu = cpu;
task_numa_compare(env, taskimp, groupimp, maymove);
}
--
2.7.4