[RFC PATCH v3 16/17] sched/cache: Drop stale preferred LLC checks

From: Jianyong Wu

Date: Wed Oct 28 2026 - 23:03:29 EST


With multi-LLC aggregation, an mm's preferred LLC can be
outside a task's preferred NUMA node. Do not discard that LLC when
calculating the task's preference.

Likewise, an LLC migration may select a destination other than the
task's preferred LLC. Let can_migrate_llc_task() decide whether the
migration is allowed instead of rejecting the task based on an exact
preferred-LLC match.

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 b93b6e6c9dea..5d11f9b7f685 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1669,27 +1669,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;
}

@@ -10898,15 +10880,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