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

Commit 9c374948 authored by Syed Rameez Mustafa's avatar Syed Rameez Mustafa
Browse files

sched: fix bail condition in bail_inter_cluster_balance()



Following commit efcad25cbfb (revert "sched: influence cpu_power based
on max_freq and efficiency), all CPUs in the system have the same
cpu_power and consequently the same group capacity. Therefore, the
check in bail_inter_cluster_balance() can now no longer be used to
distinguish a higher performance cluster from one with lower
performance. The check is currently broken and always returns true for
every load balancing attempt. Fix this by using runqueue capacity
instead which can still be used as a good measure of cluster
capabilities.

Also the logic for distinguishing between idle environments and using
a different sched group capacity in update_sd_pick_busiest() is
redundant. sgs->group_capacity would now always be equal to the number
of CPUs in the group. Use sgs->group_capacity directly in conditonal
checks in that function.

Change-Id: Idecfd1ed221d27d4324b20539e5224a92bf8b751
Signed-off-by: default avatarSteve Muckle <smuckle@codeaurora.org>
Signed-off-by: default avatarSyed Rameez Mustafa <rameezmustafa@codeaurora.org>
parent 3c7ef256
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -5456,11 +5456,10 @@ bail_inter_cluster_balance(struct lb_env *env, struct sd_lb_stats *sds)
{
	int nr_cpus;

	if (sds->this_group_capacity <= sds->busiest_group_capacity)
	if (group_rq_capacity(sds->this) <= group_rq_capacity(sds->busiest))
		return 0;

	if (sds->busiest_nr_big_tasks &&
			 sds->this_group_capacity > sds->busiest_group_capacity)
	if (sds->busiest_nr_big_tasks)
		return 0;

	nr_cpus = cpumask_weight(sched_group_cpus(sds->busiest));
@@ -5796,15 +5795,10 @@ static bool update_sd_pick_busiest(struct lb_env *env,
				   struct sched_group *sg,
				   struct sg_lb_stats *sgs)
{
	unsigned long capacity;

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

	capacity = (env->idle == CPU_NOT_IDLE) ? sgs->group_capacity :
				cpumask_weight(sched_group_cpus(sg));

	if (sgs->sum_nr_running > capacity) {
	if (sgs->sum_nr_running > sgs->group_capacity) {
		env->flags &= ~LBF_PWR_ACTIVE_BALANCE;
		return true;
	}
+6 −0
Original line number Diff line number Diff line
@@ -673,6 +673,12 @@ static inline unsigned int group_first_cpu(struct sched_group *group)

extern int group_balance_cpu(struct sched_group *sg);

/*
 * Returns the rq capacity of any rq in a group. This does not play
 * well with groups where rq capacity can change independently.
 */
#define group_rq_capacity(group) capacity(cpu_rq(group_first_cpu(group)))

#endif /* CONFIG_SMP */

#include "stats.h"