mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/cache: Check reduced capacity before alb_break_llc()
@ 2026-10-29  2:36 Zhan Xusheng
  2026-10-29  7:13 ` Kayra Cizmeci
  2026-10-29  8:18 ` Chen Yu
  0 siblings, 2 replies; 7+ messages in thread
From: Zhan Xusheng @ 2026-10-29  2:36 UTC (permalink / raw)
  To: peterz, mingo
  Cc: tim.c.chen, yu.c.chen, kayracizmeci, kprateek.nayak, juri.lelli,
	vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
	vschneid, linux-kernel, zhanxusheng

From: Zhan Xusheng <zhanxusheng@xiaomi.com>

need_active_balance() moves the only CFS task off a CPU whose capacity
is reduced, for example by IRQ load, to an idle CPU with more.
alb_break_llc() runs first and refuses to move a lone task off its
preferred LLC, so if no other CPU in that LLC is idle the task stays on
the reduced CPU.  Like asym packing, which was moved ahead of
alb_break_llc() for the same reason, this is a performance case that
cache locality should not override.

With two LLCs of two CPUs, the other CPU of the task's LLC busy and 60%
of the task's CPU spent in a hardirq, a CPU-bound two-thread process
stayed there for 20 seconds at 38% of its normal throughput.  With this
change it moves to the idle LLC within a second, as it does with cache
aware scheduling disabled.

Fixes: 714059f79ff0 ("sched/cache: Handle moving single tasks to/from their preferred LLC")
Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
---
 kernel/sched/fair.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index cfc982205b98..e313c6d212c6 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -13585,12 +13585,6 @@ static int need_active_balance(struct lb_env *env)
 	if (asym_active_balance(env))
 		return 1;
 
-	if (alb_break_llc(env))
-		return 0;
-
-	if (imbalanced_active_balance(env))
-		return 1;
-
 	/*
 	 * The dst_cpu is idle and the src_cpu CPU has only 1 CFS task.
 	 * It's worth migrating the task if the src_cpu's capacity is reduced
@@ -13604,6 +13598,12 @@ static int need_active_balance(struct lb_env *env)
 			return 1;
 	}
 
+	if (alb_break_llc(env))
+		return 0;
+
+	if (imbalanced_active_balance(env))
+		return 1;
+
 	if (env->migration_type == migrate_misfit ||
 	    env->migration_type == migrate_llc_task)
 		return 1;

base-commit: 65ba8f34ec886ec72b2c07ddc8cf3d815c32869d
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-29  8:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29  2:36 [PATCH] sched/cache: Check reduced capacity before alb_break_llc() Zhan Xusheng
2026-10-29  7:13 ` Kayra Cizmeci
2026-10-29  7:50   ` Zhan Xusheng
2026-10-29  8:13     ` Kayra Cizmeci
2026-10-29  8:18   ` Chen Yu
2026-10-29  8:18 ` Chen Yu
2026-10-29  8:55   ` Zhan Xusheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®