From 792d1aeb686a37d9e63c2b23ce20aa8c83d82cc5 Mon Sep 17 00:00:00 2001 From: zhangwei123171 Date: Mon, 6 Nov 2023 17:43:58 +0800 Subject: [PATCH] sched/fair: Remove invalid cpu selection logic in dynamic affinity jingdong inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8E8DQ ----------------------------------------------------- The CPU selected by select_task_rq_fair may not be in the corresponding cpuset. This will be corrected in the subsequent fallback process. dynamic affinity should not break this logic. Fixes: 2a3bb3c0af29 ("sched: Adjust wakeup cpu range according CPU util dynamicly") Signed-off-by: zhangwei123171 Reviewed-by: zhaoxiaoqiang11 --- 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 6f6ced57cf77..6ca8668334a0 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7413,7 +7413,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f int ret; #endif #ifdef CONFIG_QOS_SCHED_DYNAMIC_AFFINITY - int idlest_cpu = 0; + int idlest_cpu = -1; #endif time = schedstat_start_time(); @@ -7526,7 +7526,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f rcu_read_unlock(); #ifdef CONFIG_QOS_SCHED_DYNAMIC_AFFINITY - if (!cpumask_test_cpu(new_cpu, p->select_cpus)) { + if (idlest_cpu != -1 && !cpumask_test_cpu(new_cpu, p->select_cpus)) { new_cpu = idlest_cpu; schedstat_inc(p->se.statistics.nr_wakeups_force_preferred_cpus); } -- Gitee