Skip to content

Commit 4dd2760

Browse files
derklingpundiramit
authored andcommitted
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>
1 parent 406bf1f commit 4dd2760

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

kernel/sched/fair.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6686,7 +6686,9 @@ static int select_energy_cpu_brute(struct task_struct *p, int prev_cpu, int sync
66866686
/* No energy saving for target_cpu, try backup */
66876687
target_cpu = tmp_backup;
66886688
eenv.dst_cpu = target_cpu;
6689-
if (tmp_backup < 0 || energy_diff(&eenv) >= 0) {
6689+
if (tmp_backup < 0 ||
6690+
tmp_backup == prev_cpu ||
6691+
energy_diff(&eenv) >= 0) {
66906692
schedstat_inc(p, se.statistics.nr_wakeups_secb_no_nrg_sav);
66916693
schedstat_inc(this_rq(), eas_stats.secb_no_nrg_sav);
66926694
target_cpu = prev_cpu;

0 commit comments

Comments
 (0)