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

Commit 1d00c33d authored by Chris Redpath's avatar Chris Redpath Committed by Quentin Perret
Browse files

ANDROID: sched: fair: Bypass energy-aware wakeup for prefer-idle tasks



Use the upstream slow path to find an idle cpu for prefer-idle tasks.
This slow-path is actually faster than the EAS path we are currently
going through (compute_energy()) which is really slow.

No performance degradation is seen with this and it reduces the delta
quite a bit between upstream and out of tree code.

It's not clear yet if using the mainline slow path task placement when
a task has the schedtune attribute prefer_idle=1 is the right thing to
do for products. Put the option to disable this behind a sched feature
so we can try out both options.

Signed-off-by: default avatarJoel Fernandes <joelaf@google.com>
(refactored for 4.14 version)
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
(cherry picked from commit c0ff131c88f68e4985793663144b6f9cf77be9d3)
[ - Refactored for 4.17 version
  - Adjusted the commit header to the new function names ]
Signed-off-by: default avatarQuentin Perret <quentin.perret@arm.com>
Change-Id: Icf762a101c92c0e3f9e61df0370247fa15455581
parent 88d05f92
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -7064,6 +7064,9 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
		record_wakee(p);

		if (static_branch_unlikely(&sched_energy_present)) {
			if (schedtune_prefer_idle(p) && !sched_feat(EAS_PREFER_IDLE) && !sync)
				goto sd_loop;

			new_cpu = find_energy_efficient_cpu(p, prev_cpu, sync);
			if (new_cpu >= 0)
				return new_cpu;
@@ -7075,6 +7078,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
			      cpumask_test_cpu(cpu, &p->cpus_allowed);
	}

sd_loop:
	rcu_read_lock();
	for_each_domain(cpu, tmp) {
		if (!(tmp->flags & SD_LOAD_BALANCE))
+9 −0
Original line number Diff line number Diff line
@@ -95,3 +95,12 @@ SCHED_FEAT(UTIL_EST, true)
 * Fast pre-selection of CPU candidates for EAS.
 */
SCHED_FEAT(FIND_BEST_TARGET, true)

/*
 * Energy aware scheduling algorithm choices:
 * EAS_PREFER_IDLE
 *   Direct tasks in a schedtune.prefer_idle=1 group through
 *   the EAS path for wakeup task placement. Otherwise, put
 *   those tasks through the mainline slow path.
 */
SCHED_FEAT(EAS_PREFER_IDLE, true)