From a333d59090dfb854659f75e531c4adf1cd229c38 Mon Sep 17 00:00:00 2001 From: zhangwei123171 Date: Mon, 18 Dec 2023 21:53:49 +0800 Subject: [PATCH] sched/fair: reset idlest_cpu if not meet the conditions for preferred CPU jingdong inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8PGAS ----------------------------------------------------- We have set the preferred CPU, but when the load is too high, the conditions for the preferred CPU are not met. At this time, the idle CPU needs to be reset. 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ce8e75e1809e..16f6720a244c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7869,6 +7869,8 @@ static void set_task_select_cpus(struct task_struct *p, int *idlest_cpu, p->select_cpus = p->prefer_cpus; if (sd_flag & SD_BALANCE_WAKE) schedstat_inc(p->se.statistics.nr_wakeups_preferred_cpus); + } else if (idlest_cpu) { + *idlest_cpu = -1; } } #endif -- Gitee