aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Perret <quentin.perret@arm.com>2018-05-24 17:35:02 +0100
committerAmit Pundir <amit.pundir@linaro.org>2018-10-08 10:20:23 +0530
commitb582687429b6281d7c63d7b5e89e143e55415a8c (patch)
treef84133b4bca481d0de91d7b28c2236257545c5ff
parent6a3f85fa2f511ba86a17eb61c286282bee554b0a (diff)
downloadlinaro-android-b582687429b6281d7c63d7b5e89e143e55415a8c.tar.gz
ANDROID: sched/fair: Bypass energy computation for prefer_idle tasks
If the only pre-selected candidate CPU in find_energy_efficient_cpu() happens to be prev_cpu, there is not point in computing the system energy since we have nothing to compare it against, so we currently bail out early. The same logic can be extended when prefer_idle tasks are routed in the energy-aware wake-up path: if the only candidate is idle for a prefer_idle task, just select it no matter what the energy impact is. That should help speeding-up wake-ups of prefer_idle tasks, at least when find_best_target() is used for them. Signed-off-by: Quentin Perret <quentin.perret@arm.com> Change-Id: Idd0e387e4a766061cc05d2584df3a31e4dabfd09
-rw-r--r--kernel/sched/fair.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 95d4a3beea1c..2384841c5ceb 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6969,11 +6969,17 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
else
select_max_spare_cap_cpus(sd, candidates, pd, p);
- /* Bail out if there is no candidate, or if the only one is prev_cpu */
+ /* Bail out if no candidate was found. */
weight = cpumask_weight(candidates);
- if (!weight || (weight == 1 && cpumask_first(candidates) == prev_cpu))
+ if (!weight)
return prev_cpu;
+ /* If there is only one sensible candidate, select it now. */
+ cpu = cpumask_first(candidates);
+ if (weight == 1 && ((schedtune_prefer_idle(p) && idle_cpu(cpu)) ||
+ (cpu == prev_cpu)))
+ return cpu;
+
if (cpumask_test_cpu(prev_cpu, &p->cpus_allowed))
prev_energy = best_energy = compute_energy(p, prev_cpu, pd);
else