sched: EAS: update trg_cpu to backup_cpu if no energy saving for target_cpu
authorKe Wang <ke.wang@spreadtrum.com>
Mon, 30 Oct 2017 09:38:16 +0000 (17:38 +0800)
committerTodd Kjos <tkjos@google.com>
Thu, 2 Nov 2017 17:59:53 +0000 (17:59 +0000)
If no energy saving for target_cpu in the calculation of energy_diff(),
backup_cpu will be set as the new dst_cpu for the next calculation. At this
point, we also need update the new trg_cpu as backup_cpu to make sure the
subsequent calculation of energy_diff() is correct.

Signed-off-by: Ke Wang <ke.wang@spreadtrum.com>
kernel/sched/fair.c

index 06b814b58d205aa00b039f616199b947673ea670..3b429c5ce7212cbe91147b11e2cb18588eb33159 100644 (file)
@@ -6723,6 +6723,7 @@ 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;
+                       eenv.trg_cpu = target_cpu;
                        if (tmp_backup < 0 ||
                            tmp_backup == prev_cpu ||
                            energy_diff(&eenv) >= 0) {