aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMorten Rasmussen <morten.rasmussen@arm.com>2016-06-22 18:03:14 +0100
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:32:12 +0200
commit9f45e41f9d743ed65dd5379e0af4d643d6a710aa (patch)
tree5d073ee750a67c3dd0821985bab7bd54bcbcd6ac /kernel
parent662287558f37ed46e0612a34d5e58b89f6af3a48 (diff)
sched/fair: Optimize find_idlest_cpu() when there is no choice
In the current find_idlest_group()/find_idlest_cpu() search we end up calling find_idlest_cpu() in a sched_group containing only one CPU in the end. Checking idle-states becomes pointless when there is no alternative, so bail out instead. Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com> 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: dietmar.eggemann@arm.com Cc: linux-kernel@vger.kernel.org Cc: mgalbraith@suse.de Cc: vincent.guittot@linaro.org Cc: yuyang.du@intel.com Link: http://lkml.kernel.org/r/1466615004-3503-4-git-send-email-morten.rasmussen@arm.com Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: RyTek <rytek1128@outlook.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/fair.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 210fdfe78..12a1bc40b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4902,6 +4902,10 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
int idlest = -1;
int i;
+ /* Check if we have any choice: */
+ if (group->group_weight == 1)
+ return cpumask_first(sched_group_cpus(group));
+
/* Traverse only the allowed CPUs */
for_each_cpu_and(i, sched_group_cpus(group), tsk_cpus_allowed(p)) {
load = weighted_cpuload(i);