[PATCH] sched/fair: Move WARN_ON_ONCE to more_balance after dst_cpu can change

fangqiurong posted 1 patch 3 weeks, 6 days ago
kernel/sched/fair.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] sched/fair: Move WARN_ON_ONCE to more_balance after dst_cpu can change
Posted by fangqiurong 3 weeks, 6 days ago
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@kylinos.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