[RFC PATCH v2 19/23] sched/cache: Remove preferred LLC/node check no longer needed

From: Jianyong Wu

Date: Thu Aug 27 2026 - 22:14:54 EST


When CAS extends to the whole system, preferred LLC may not locate inside
preferred node of a certain thread and migration can happen to move to a
destination cpu that is not thread group's preferred LLC. So, all of these
check should be removed.

Signed-off-by: Jianyong Wu <wujianyong@xxxxxxxx>
---
kernel/sched/fair.c | 29 +----------------------------
1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 27cb05373a1d..45dd3e5e0a86 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1680,27 +1680,9 @@ static int get_pref_llc(struct task_struct *p, struct mm_struct *mm)
return -1;

mm_sched_cpu = READ_ONCE(mm->sc_stat.cpu);
- if (mm_sched_cpu != -1) {
+ if (mm_sched_cpu != -1)
mm_sched_llc = llc_id(mm_sched_cpu);

-#ifdef CONFIG_NUMA_BALANCING
- /*
- * Don't assign preferred LLC if it
- * conflicts with NUMA balancing.
- * This can happen when sched_setnuma() gets
- * called, however it is not much of an issue
- * because we expect account_mm_sched() to get
- * called fairly regularly -- at a higher rate
- * than sched_setnuma() at least -- and thus the
- * conflict only exists for a short period of time.
- */
- if (static_branch_likely(&sched_numa_balancing) &&
- p->numa_preferred_nid >= 0 &&
- cpu_to_node(mm_sched_cpu) != p->numa_preferred_nid)
- mm_sched_llc = -1;
-#endif
- }
-
return mm_sched_llc;
}

@@ -10917,15 +10899,6 @@ static bool migrate_degrades_llc(struct task_struct *p, struct lb_env *env)
if (env->sd->nr_balance_failed >= env->sd->cache_nice_tries + 1)
return false;

- /*
- * We know the env->src_cpu has some tasks prefer to
- * run on env->dst_cpu, skip the tasks do not prefer
- * env->dst_cpu, and find the one that prefers.
- */
- if (env->migration_type == migrate_llc_task &&
- READ_ONCE(p->preferred_llc) != llc_id(env->dst_cpu))
- return true;
-
if (can_migrate_llc_task(env->src_cpu,
env->dst_cpu, p) != mig_forbid)
return false;
--
2.34.1