From 0b76f7d59db50ed9d220cebd435a313a19f9d01a Mon Sep 17 00:00:00 2001 From: Abhijeet Dharmapurikar Date: Wed, 19 Oct 2022 15:04:16 -0700 Subject: [PATCH] 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 --- kernel/sched/walt/walt.h | 23 +++++++++++------------ kernel/sched/walt/walt_cfs.c | 10 ++++------ 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/kernel/sched/walt/walt.h b/kernel/sched/walt/walt.h index c72e68120ee5..37182af1feb0 100644 --- a/kernel/sched/walt/walt.h +++ b/kernel/sched/walt/walt.h @@ -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); diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index 83183cd8c873..e143c013c7e4 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -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 {