From: Yang Yingliang yangyingliang@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8UR4U CVE: NA
--------------------------------
If cpuset_cpu_inactive() fails in sched_cpu_deactivate(), the cpu offline failed, but sched_smt_present is decreased before calling sched_cpu_deactivate, it leads unbalance dec/inc, so fix it by increasing sched_smt_present in the error path.
Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Yu Liao liaoyu15@huawei.com Signed-off-by: Xia Fukun xiafukun@huawei.com --- kernel/sched/core.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7a0997e7e136..adecea9c607d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -9792,6 +9792,10 @@ int sched_cpu_deactivate(unsigned int cpu) ret = cpuset_cpu_inactive(cpu); if (ret) { balance_push_set(cpu, false); +#ifdef CONFIG_SCHED_SMT + if (cpumask_weight(cpu_smt_mask(cpu)) == 2) + static_branch_inc_cpuslocked(&sched_smt_present); +#endif set_cpu_active(cpu, true); sched_update_numa(cpu, true); return ret;
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3904 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/P...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3904 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/P...