From c5ce59ba7623c898539b64ecedc9929592af97e6 Mon Sep 17 00:00:00 2001 From: zhangwei123171 Date: Mon, 9 Oct 2023 16:48:15 +0800 Subject: [PATCH] sched/fair: skip smt expel when cpu down jingdong inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I86JWB --------------------------------------------------- 1. smt expel IPI is not needed for a dying cpu. 2. pick_next_task_fair cannot return NULL due to the smt expel function during cpu down handler. Affects the migration of tasks. Fixes: fd5207be48fa9 ("sched: Implement the function of qos smt expeller") Fixes: e4108f66d97aa ("sched/fair: Introduce QOS_SMT_EXPELL priority reversion mechanism") Signed-off-by: zhangwei123171 Reviewed-by: zhaoxiaoqiang11 --- kernel/sched/fair.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 25f5fd215222..e6aeda568921 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8163,6 +8163,9 @@ static void qos_smt_send_ipi(int this_cpu) rq = cpu_rq(cpu); + if (unlikely(!rq->online)) + continue; + /* * There are two cases where current don't need to send * scheduler_ipi: @@ -8301,7 +8304,7 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf again: #ifdef CONFIG_QOS_SCHED_SMT_EXPELLER - if (qos_smt_expelled(this_cpu) && !__this_cpu_read(qos_cpu_overload)) { + if (rq->online && qos_smt_expelled(this_cpu) && !__this_cpu_read(qos_cpu_overload)) { __this_cpu_write(qos_smt_status, CPU_SMT_EXPELLED); if (!qos_timer_is_activated(this_cpu)) -- Gitee