From: zhangwei123171 zhangwei123171@jd.com
jingdong inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8PGQ2
--------------------------------
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: f6cee1481527 ("sched: Adjust wakeup cpu range according CPU util dynamicly") Signed-off-by: zhangwei123171 zhangwei123171@jd.com Signed-off-by: Hui Tang tanghui20@huawei.com --- 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 0214f954b166..571fd9bf7233 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8121,7 +8121,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) /* SD_flags and WF_flags share the first nibble */ int sd_flag = wake_flags & 0xF; #ifdef CONFIG_QOS_SCHED_DYNAMIC_AFFINITY - int idlest_cpu = 0; + int idlest_cpu = -1; #endif
/* @@ -8196,7 +8196,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) 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->stats.nr_wakeups_force_preferred_cpus); }