[PATCH 3/4] sched/core: Enable core scheduler only for core with SMT threads
From: Tim Chen
Date: Tue Jan 07 2020 - 16:22:28 EST
Core scheduler has extra overhead. Enable it only for core with
more than one SMT hardware threads.
Signed-off-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
---
kernel/sched/core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1a132beba3f8..9d875d6ed3f3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -280,8 +280,10 @@ static int __sched_core_stopper(void *data)
}
}
- for_each_online_cpu(cpu)
- cpu_rq(cpu)->core_enabled = enabled;
+ for_each_online_cpu(cpu) {
+ if (!enabled || (enabled && cpumask_weight(cpu_smt_mask(cpu)) >= 2))
+ cpu_rq(cpu)->core_enabled = enabled;
+ }
return 0;
}
--
2.20.1