Re: [PATCH v4 08/20] sched/fair: load balance only among preferred CPUs

From: Shrikanth Hegde

Date: Wed Jun 17 2026 - 23:56:00 EST


Hi Prateek, thanks for going through the patches.

On 6/18/26 8:33 AM, K Prateek Nayak wrote:
Hello Shrikanth,

On 6/17/2026 11:11 PM, Shrikanth Hegde wrote:
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d78467ec6ee1..3f3c7f0ca489 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -13291,6 +13291,9 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq,
cpumask_and(cpus, sched_domain_span(sd), cpu_active_mask);
+ /* Spread load among preferred CPUs */
+ cpumask_and(cpus, cpus, cpu_preferred_mask);

Since "cpu_preferred_mask" is a subset of "cpu_active_mask", just:

cpumask_and(cpus, sched_domain_span(sd), cpu_preferred_mask);

is sufficient. We don't need that redundant cpumask_and() with
cpu_active_mask before.


Ack.

+
schedstat_inc(sd->lb_count[idle]);
redo: