From 0d724006aa36d1270ea02e912ebdc8c64f22226c Mon Sep 17 00:00:00 2001 From: Alfred Chen Date: Mon, 19 Apr 2021 10:11:56 +0800 Subject: [PATCH] sched/alt: Fix task migratie to dying cpu. Fix #23 WARNING: CPU: 2 PID: 26 at kernel/sched/alt_core.c:6294 sched_cpu_dying.cold+0xc/0xd2 --- kernel/sched/alt_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/sched/alt_core.c b/kernel/sched/alt_core.c index 4ed1ff9f1aab89..6350afe339855d 100644 --- a/kernel/sched/alt_core.c +++ b/kernel/sched/alt_core.c @@ -1619,7 +1619,7 @@ static inline int select_task_rq(struct task_struct *p, struct rq *rq) { cpumask_t chk_mask, tmp; - if (unlikely(!cpumask_and(&chk_mask, p->cpus_ptr, cpu_online_mask))) + if (unlikely(!cpumask_and(&chk_mask, p->cpus_ptr, cpu_active_mask))) return select_fallback_rq(task_cpu(p), p); if ( @@ -3420,6 +3420,10 @@ static inline void sg_balance_check(struct rq *rq) if (cpumask_empty(&sched_sg_idle_mask)) return; + /* exit when cpu is offline */ + if (unlikely(!rq->online)) + return; + cpu = cpu_of(rq); /* * Only cpu in slibing idle group will do the checking and then