From: zhangwei123171 zhangwei123171@jd.com
jingdong inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8PGQ3
--------------------------------
In a co-location scenario, when an online container uses the dynamic affinity capability, the CPU that is full of offline tasks will also be used as an idle CPU, which is more friendly to online tasks.
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 571fd9bf7233..517c30a5dcdb 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8067,7 +8067,7 @@ static void set_task_select_cpus(struct task_struct *p, int *idlest_cpu, rcu_read_lock(); tg = task_group(p); for_each_cpu(cpu, p->prefer_cpus) { - if (idlest_cpu && available_idle_cpu(cpu)) { + if (idlest_cpu && (available_idle_cpu(cpu) || sched_idle_cpu(cpu))) { *idlest_cpu = cpu; } else if (idlest_cpu) { spare = (long)(capacity_of(cpu) - @@ -8078,7 +8078,7 @@ static void set_task_select_cpus(struct task_struct *p, int *idlest_cpu, } }
- if (available_idle_cpu(cpu)) { + if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) { rcu_read_unlock(); p->select_cpus = p->prefer_cpus; if (sd_flag & SD_BALANCE_WAKE)