summaryrefslogtreecommitdiffstats
path: root/kernel/sched/fair.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2016-05-09 10:38:41 +0200
committerIngo Molnar <mingo@kernel.org>2016-09-30 11:03:26 +0200
commit1b568f0aabf280555125bc7cefc08321ff0ebaba (patch)
tree5ca491fb2b8a7ff46af700bc64c2d83cea68eabb /kernel/sched/fair.c
parent10e2f1acd0106c05229f94c70a344ce3a2c8008b (diff)
downloadlinux-1b568f0aabf280555125bc7cefc08321ff0ebaba.tar.bz2
sched/core: Optimize SCHED_SMT
Avoid pointless SCHED_SMT code when running on !SMT hardware. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/fair.c')
-rw-r--r--kernel/sched/fair.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6b41589c41e4..87caf2bd26f0 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5357,7 +5357,7 @@ static inline bool test_idle_cores(int cpu, bool def)
* Since SMT siblings share all cache levels, inspecting this limited remote
* state should be fairly cheap.
*/
-void update_idle_core(struct rq *rq)
+void __update_idle_core(struct rq *rq)
{
int core = cpu_of(rq);
int cpu;
@@ -5389,6 +5389,9 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int
struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask);
int core, cpu, wrap;
+ if (!static_branch_likely(&sched_smt_present))
+ return -1;
+
if (!test_idle_cores(target, false))
return -1;
@@ -5422,6 +5425,9 @@ static int select_idle_smt(struct task_struct *p, struct sched_domain *sd, int t
{
int cpu;
+ if (!static_branch_likely(&sched_smt_present))
+ return -1;
+
for_each_cpu(cpu, cpu_smt_mask(target)) {
if (!cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
continue;