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

Commit 5285b641 authored by Joonwoo Park's avatar Joonwoo Park Committed by Matt Wagantall
Browse files

sched: continue to search less power efficient cpu for load balancer



When choosing a CPU to do power-aware active balance from the load
balancer currently selects the first eligible CPU it finds, even if
there is another eligible CPU which is higher-power. This can lead to
suboptimal load balancing behavior and extra migrations. Power and
performance will be impacted.

Achieve better power and performance by continuing to search the least
power efficient cpu as long as the cpu's load average is higher than or
equal to the busiest cpu found by far.

CRs-fixed: 777341
Change-Id: I14eb21ab725bf7dab88b2e1e169aced6f2d712ca
Signed-off-by: default avatarJoonwoo Park <joonwoop@codeaurora.org>
Signed-off-by: default avatarSyed Rameez Mustafa <rameezmustafa@codeaurora.org>
parent d4b23574
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -7618,7 +7618,7 @@ struct sched_group *group, struct sg_lb_stats *sgs, struct lb_env *env)
	 * seen a busy group yet and we are close to throttling. We want to
	 * prioritize spreading work over power optimization.
	 */
	cpu = cpumask_first(sched_group_cpus(group));
	cpu = group_first_cpu(group);
	if (sysctl_sched_enable_power_aware &&
	    (capacity(env->dst_rq) == group_rq_capacity(group)) &&
	    sgs->sum_nr_running && (env->idle != CPU_NOT_IDLE) &&
@@ -7739,8 +7739,13 @@ static bool update_sd_pick_busiest(struct lb_env *env,
		return false;
	}

	if (env->flags & LBF_PWR_ACTIVE_BALANCE)
	if (env->flags & LBF_PWR_ACTIVE_BALANCE) {
		if (power_cost_at_freq(group_first_cpu(sg), 0) <=
		    power_cost_at_freq(group_first_cpu(sds->busiest), 0))
			return false;

		return true;
	}

	if (sgs->avg_load <= busiest->avg_load)
		return false;