summaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorPatrick Bellasi <patrick.bellasi@arm.com>2017-09-07 12:27:56 +0100
committerChris Redpath <chris.redpath@arm.com>2017-10-27 13:30:33 +0100
commit4edc5b0e387a906a00cb45af2abf76aa3a930438 (patch)
tree34dd5ab1860ae89999f7351c36332f2d6c15c1b4 /kernel/sched
parent2aada289d7be37116f21d70177cb06a929b5d961 (diff)
sched/fair: ignore backup CPU when not valid
The find_best_target can sometimes not return a valid backup CPU, either because it cannot find one or just becasue it returns prev_cpu as a backup. In these cases we should skip the energy_diff evaluation for the backup CPU. Change-Id: I3787dbdfe74122348dd7a7485b88c4679051bd32 Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com> Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/fair.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a17820385ee2..417b373e4074 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6686,7 +6686,9 @@ static int select_energy_cpu_brute(struct task_struct *p, int prev_cpu, int sync
/* No energy saving for target_cpu, try backup */
target_cpu = tmp_backup;
eenv.dst_cpu = target_cpu;
- if (tmp_backup < 0 || energy_diff(&eenv) >= 0) {
+ if (tmp_backup < 0 ||
+ tmp_backup == prev_cpu ||
+ energy_diff(&eenv) >= 0) {
schedstat_inc(p, se.statistics.nr_wakeups_secb_no_nrg_sav);
schedstat_inc(this_rq(), eas_stats.secb_no_nrg_sav);
target_cpu = prev_cpu;