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

Commit 398bb7db authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched/fair: Fix is_packing_eligible() for !SCHED_WALT



The find_best_target() checks if packing is eligible or not on
an active CPU before selecting it as the primary candidate CPU.
The is_packing_eligible() function checks if the currently
waking task can fit on the active CPU without increasing the
OPP or not. The current implementation only works for WALT. Make
it work even when WALT is disabled.

Change-Id: Iba7a2b6aca2dd2feca6f2e910888276113969186
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 3521322b
Loading
Loading
Loading
Loading
+23 −7
Original line number Diff line number Diff line
@@ -6814,12 +6814,33 @@ struct find_best_target_env {
	bool avoid_prev_cpu;
};

#ifdef CONFIG_SCHED_WALT
static unsigned long cpu_estimated_capacity(int cpu, struct task_struct *p)
{
	unsigned long tutil, estimated_capacity;

	if (task_in_cum_window_demand(cpu_rq(cpu), p))
		tutil = 0;
	else
		tutil = task_util(p);

	estimated_capacity = cpu_util_cum(cpu, tutil);

	return estimated_capacity;
}
#else
static unsigned long cpu_estimated_capacity(int cpu, struct task_struct *p)
{
	return cpu_util_wake(cpu, p);
}
#endif

static bool is_packing_eligible(struct task_struct *p, int target_cpu,
				struct find_best_target_env *fbt_env,
				unsigned int target_cpus_count,
				int best_idle_cstate)
{
	unsigned long tutil, estimated_capacity;
	unsigned long estimated_capacity;

	if (fbt_env->placement_boost || fbt_env->need_idle)
		return false;
@@ -6830,12 +6851,7 @@ static bool is_packing_eligible(struct task_struct *p, int target_cpu,
	if (target_cpus_count != 1)
		return true;

	if (task_in_cum_window_demand(cpu_rq(target_cpu), p))
		tutil = 0;
	else
		tutil = task_util(p);

	estimated_capacity = cpu_util_cum(target_cpu, tutil);
	estimated_capacity = cpu_estimated_capacity(target_cpu, p);
	estimated_capacity = add_capacity_margin(estimated_capacity,
						 target_cpu);