sched/walt: don't pass capacity to task_fits_max

There is no need for the callsites to pass the capacity of the new cpu.
It is best if task_fits_max() gets it as it is the only one that uses
it.

Also take this opportunity to change the variable name "cpu" to "dst_cpu".

Change-Id: I836f779b31a4c8f7bc5f9c87c40f4fa5caf786f2
Signed-off-by: Abhijeet Dharmapurikar <quic_adharmap@quicinc.com>
This commit is contained in:
Abhijeet Dharmapurikar 2022-10-19 15:04:16 -07:00 committed by Stephen Dickey
parent a569117648
commit 0b76f7d59d
2 changed files with 15 additions and 18 deletions

View File

@ -772,20 +772,20 @@ static bool check_for_higher_capacity(int cpu1, int cpu2)
extern unsigned int sysctl_sched_early_up[MAX_MARGIN_LEVELS];
extern unsigned int sysctl_sched_early_down[MAX_MARGIN_LEVELS];
static inline bool task_fits_capacity(struct task_struct *p,
long capacity,
int cpu)
int dst_cpu)
{
unsigned int margin;
unsigned long capacity = capacity_orig_of(dst_cpu);
/*
* Derive upmigration/downmigrate margin wrt the src/dest CPU.
*/
if (check_for_higher_capacity(task_cpu(p), cpu)) {
margin = sched_capacity_margin_down[cpu];
if (check_for_higher_capacity(task_cpu(p), dst_cpu)) {
margin = sched_capacity_margin_down[dst_cpu];
if (task_in_related_thread_group(p)) {
if (is_min_cluster_cpu(cpu))
if (is_min_cluster_cpu(dst_cpu))
margin = sysctl_sched_early_down[0];
else if (!is_max_cluster_cpu(cpu))
else if (!is_max_cluster_cpu(dst_cpu))
margin = sysctl_sched_early_down[1];
}
} else {
@ -801,19 +801,18 @@ static inline bool task_fits_capacity(struct task_struct *p,
return capacity * 1024 > uclamp_task_util(p) * margin;
}
static inline bool task_fits_max(struct task_struct *p, int cpu)
static inline bool task_fits_max(struct task_struct *p, int dst_cpu)
{
unsigned long capacity = capacity_orig_of(cpu);
unsigned long task_boost = per_task_boost(p);
if (is_max_cluster_cpu(cpu))
if (is_max_cluster_cpu(dst_cpu))
return true;
if (is_min_cluster_cpu(cpu)) {
if (is_min_cluster_cpu(dst_cpu)) {
if (task_boost_policy(p) == SCHED_BOOST_ON_BIG ||
task_boost > 0 ||
walt_uclamp_boosted(p) ||
walt_should_kick_upmigrate(p, cpu))
walt_should_kick_upmigrate(p, dst_cpu))
return false;
} else { /* mid cap cpu */
if (task_boost > TASK_BOOST_ON_MID)
@ -823,7 +822,7 @@ static inline bool task_fits_max(struct task_struct *p, int cpu)
return true;
}
return task_fits_capacity(p, capacity, cpu);
return task_fits_capacity(p, dst_cpu);
}
extern struct sched_avg_stats *sched_get_nr_running_avg(void);

View File

@ -72,19 +72,17 @@ bias_to_this_cpu(struct task_struct *p, int cpu, int start_cpu)
return base_test && start_cap_test;
}
static inline bool task_demand_fits(struct task_struct *p, int cpu)
static inline bool task_demand_fits(struct task_struct *p, int dst_cpu)
{
unsigned long capacity = capacity_orig_of(cpu);
if (is_max_cluster_cpu(cpu))
if (is_max_cluster_cpu(dst_cpu))
return true;
if (!task_in_related_thread_group(p) && p->prio >= 124 &&
!is_min_cluster_cpu(cpu) && !is_max_cluster_cpu(cpu)) {
!is_min_cluster_cpu(dst_cpu) && !is_max_cluster_cpu(dst_cpu)) {
/* a non topapp low prio task fits on gold */
return true;
}
return task_fits_capacity(p, capacity, cpu);
return task_fits_capacity(p, dst_cpu);
}
struct find_best_target_env {