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

Commit c0ff131c authored by Chris Redpath's avatar Chris Redpath
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 (select_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.

Change-Id: Icf762a101c92c0e3f9e61df0370247fa15455581
Signed-off-by: default avatarJoel Fernandes <joelaf@google.com>
(refactored for 4.14 version)
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
parent 9a7ed259
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -6713,6 +6713,7 @@ static inline int wake_energy(struct task_struct *p, int prev_cpu,
			      int sd_flag, int wake_flags)
{
	struct sched_domain *sd = NULL;
	int sync = wake_flags & WF_SYNC;

	sd = rcu_dereference_sched(cpu_rq(prev_cpu)->sd);

@@ -6728,6 +6729,14 @@ static inline int wake_energy(struct task_struct *p, int prev_cpu,
	if (sd_overutilized(sd))
		return false;

	if(!sched_feat(EAS_PREFER_IDLE)){
		/*
		 * Force prefer-idle tasks into the slow path, this may not happen
		 * if none of the sd flags matched.
		 */
		if (schedtune_prefer_idle(p) > 0 && !sync)
			return false;
	}
	return true;
}

+9 −0
Original line number Diff line number Diff line
@@ -95,3 +95,12 @@ SCHED_FEAT(ENERGY_AWARE, true)
#else
SCHED_FEAT(ENERGY_AWARE, false)
#endif

/*
 * 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)