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

Commit a0d504e9 authored by Satya Durga Srinivasu Prabhala's avatar Satya Durga Srinivasu Prabhala
Browse files

sched/fair: use tunable value for capacity margin checks



As user can change the migration thresholds, need to use the
upmigration threshold for capcity margin checks instead of
hard coded one to avoid undesired behavior.

Change-Id: I83e68bbaeba814c720af5e6ae4c37b4162141c51
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent 387e9dc0
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -7366,7 +7366,7 @@ static int wake_cap(struct task_struct *p, int cpu, int prev_cpu)
bool __cpu_overutilized(int cpu, int delta)
{
	return (capacity_orig_of(cpu) * 1024) <
		((cpu_util(cpu) + delta) * capacity_margin);
		((cpu_util(cpu) + delta) * sched_capacity_margin_up[cpu]);
}

bool cpu_overutilized(int cpu)
@@ -7579,7 +7579,8 @@ static int find_energy_efficient_cpu(struct sched_domain *sd,

			spare = capacity_spare_wake(cpu_iter, p);

			if (spare * 1024 < capacity_margin * task_util(p))
			if (spare * 1024 < sched_capacity_margin_up[cpu_iter] *
								task_util(p))
				continue;

			/* Add CPU candidate */
@@ -9285,7 +9286,8 @@ group_is_overloaded(struct lb_env *env, struct sg_lb_stats *sgs)
static inline bool
group_smaller_cpu_capacity(struct sched_group *sg, struct sched_group *ref)
{
	return sg->sgc->min_capacity * capacity_margin <
	return sg->sgc->min_capacity *
				sched_capacity_margin_up[group_first_cpu(sg)] <
						ref->sgc->min_capacity * 1024;
}

@@ -9676,7 +9678,8 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
	 * needs to be done at the next sched domain level as well.
	 */
	if (lb_sd_parent(env->sd) &&
	    sds->total_capacity * 1024 < sds->total_util * capacity_margin)
	    sds->total_capacity * 1024 < sds->total_util *
			sched_capacity_margin_up[group_first_cpu(sds->local)])
		set_sd_overutilized(env->sd->parent);
}