[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20260113075051.3959560-1-fangqiurong@kylinos.cn>
Date: Tue, 13 Jan 2026 15:50:51 +0800
From: fangqiurong <fangqiurong@...inos.cn>
To: mingo@...hat.com,
peterz@...radead.org
Cc: linux-kernel@...r.kernel.org,
fangqiurong <fangqiurong@...inos.cn>
Subject: [PATCH] sched/fair: Move WARN_ON_ONCE to more_balance after dst_cpu can change
The LBF_DST_PINNED path may change env.dst_cpu and jump to more_balance
to restart load balancing with the new destination. In this case, we need
to verify that busiest != dst_rq to prevent attempting to load balance
a runqueue with itself.
Signed-off-by: fangqiurong <fangqiurong@...inos.cn>
---
kernel/sched/fair.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 5b7523242..5810cf882 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11777,8 +11777,6 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq,
goto out_balanced;
}
- WARN_ON_ONCE(busiest == env.dst_rq);
-
update_lb_imbalance_stat(&env, sd, idle);
env.src_cpu = busiest->cpu;
@@ -11797,6 +11795,8 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq,
env.loop_max = min(sysctl_sched_nr_migrate, busiest->nr_running);
more_balance:
+ WARN_ON_ONCE(busiest == env.dst_rq);
+
rq_lock_irqsave(busiest, &rf);
update_rq_clock(busiest);
--
2.25.1
Powered by blists - more mailing lists