Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18eaaf28 authored by Chris Redpath's avatar Chris Redpath Committed by Abhijeet Dharmapurikar
Browse files

ANDROID: sched/fair: return idle CPU immediately for prefer_idle



When a CPU is selected for a prefer_idle task through find_best_target
this CPU will become a target CPU on which we perform an energy diff and
select between the previous CPU and the target CPU based on the estimated
energy consumption for both placements.

For prefer_idle tasks we should favour performance over energy savings
and therefore return a found idle CPU immediately.

Change-Id: I2242a51134ac172dd58b3b08375388a7b4b84af0
Signed-off-by: default avatarIonela Voinescu <ionela.voinescu@arm.com>
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
Suggested-by: default avatarJoel Fernandes <joelaf@google.com>
Git-commit: dc6f7513
Git-repo: http://android.googlesource.com/kernel/common


[adharmap@codeaurora.org: Continue to return prev_cpu instead of -1
in case we cannot find a suitable cpu to place the task. The variable
energy_cpu is kept around for just that.]
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent 11bbf5a7
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -7719,6 +7719,7 @@ static int find_energy_efficient_cpu(struct sched_domain *sd,
	int use_fbt = sched_feat(FIND_BEST_TARGET);
	int cpu_iter, eas_cpu_idx = EAS_CPU_NXT;
	int energy_cpu = prev_cpu, delta = 0;
	int target_cpu = -1;
	struct energy_env *eenv;
	struct cpumask *rtg_target = find_rtg_target(p);
	struct find_best_target_env fbt_env;
@@ -7795,9 +7796,18 @@ static int find_energy_efficient_cpu(struct sched_domain *sd,
		fbt_env.need_idle = need_idle;

		/* Find a cpu with sufficient capacity */
		eenv->cpu[EAS_CPU_NXT].cpu_id = find_best_target(p,
				&eenv->cpu[EAS_CPU_BKP].cpu_id,
		target_cpu = find_best_target(p, &eenv->cpu[EAS_CPU_BKP].cpu_id,
					      boosted, prefer_idle, &fbt_env);

		/* Immediately return a found idle CPU for a prefer_idle task */
		if (prefer_idle && target_cpu >= 0 && idle_cpu(target_cpu)) {
			energy_cpu = target_cpu;
			goto out;
		}

		/* Place target into NEXT slot */
		eenv->cpu[EAS_CPU_NXT].cpu_id = target_cpu;

		next_cpu = eenv->cpu[EAS_CPU_NXT].cpu_id;
		backup_cpu = eenv->cpu[EAS_CPU_BKP].cpu_id;