[PATCH] sched: Check core scheduler in use when comparing cookie

From: Tim Chen
Date: Thu Dec 12 2019 - 12:08:18 EST


When scanning scheduler groups to find the idlest cpu for a task waking
up, cookie matching should not be considered if a target cpu doesn't
use core scheduling. Code introduced by patch

sched/fair: find cookie matched idlest CPU

matches cookie regardless of cpu's core scheduler state. Fix this.

Signed-off-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
---
kernel/sched/fair.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a90179937f63..55e7b22522db 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5656,8 +5656,15 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
for_each_cpu(i, sched_group_span(group)) {
struct rq *rq = cpu_rq(i);

- if (p->core_cookie == rq->core->core_cookie)
+ if (!sched_core_enabled(rq)) {
cookie_match = true;
+ break;
+ }
+
+ if (p->core_cookie == rq->core->core_cookie) {
+ cookie_match = true;
+ break;
+ }
}
/* Skip over this group if no cookie matched */
if (!cookie_match)
--
2.20.1