From a569117648ab796a817af54d2a4f84bed011b253 Mon Sep 17 00:00:00 2001 From: Stephen Dickey Date: Thu, 22 Sep 2022 13:09:40 -0700 Subject: [PATCH] sched/walt: update walt_get_indicies for 4 clusters walt_get_indices() was written for a 3 cluster system. In the future it is necessary to support 2, 3 and 4 cluster systems. Make the appropriate changes to walt_get_indices such that cpus are visited in the correct order for each of these topologies. Change-Id: Iae60c152aaa561326adccc0e92056e598dde2679 Signed-off-by: Stephen Dickey --- kernel/sched/walt/walt_cfs.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index 456f5560743b..83183cd8c873 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -165,8 +165,6 @@ static void walt_get_indicies(struct task_struct *p, int *order_index, int *end_index, int per_task_boost, bool is_uclamp_boosted, bool *energy_eval_needed) { - int i = 0; - *order_index = 0; *end_index = 0; @@ -182,9 +180,12 @@ static void walt_get_indicies(struct task_struct *p, int *order_index, if (is_full_throttle_boost()) { *energy_eval_needed = false; *order_index = num_sched_clusters - 1; - if ((*order_index > 1) && task_demand_fits(p, - cpumask_first(&cpu_array[*order_index][1]))) - *end_index = 1; + *end_index = num_sched_clusters - 2; + + for (; *end_index >= 0; (*end_index)--) + if (task_demand_fits(p, + cpumask_first(&cpu_array[*order_index][*end_index]))) + break; return; } @@ -193,19 +194,19 @@ static void walt_get_indicies(struct task_struct *p, int *order_index, walt_task_skip_min_cpu(p)) { *energy_eval_needed = false; *order_index = 1; + *end_index = max(0, num_sched_clusters - 3); + if (sysctl_sched_asymcap_boost) { - *end_index = 1; + (*end_index)++; return; } } - for (i = *order_index ; i < num_sched_clusters - 1; i++) { - if (task_demand_fits(p, cpumask_first(&cpu_array[i][0]))) + for (; *order_index < num_sched_clusters - 1; (*order_index)++) { + if (task_demand_fits(p, cpumask_first(&cpu_array[*order_index][0]))) break; } - *order_index = i; - if (*order_index == 0 && (task_util(p) >= MIN_UTIL_FOR_ENERGY_EVAL) && !(p->in_iowait && task_in_related_thread_group(p)) &&