From 4bb9750f22b9e453a5ec04d454f5b06a3519239a Mon Sep 17 00:00:00 2001 From: Ashay Jaiswal Date: Tue, 12 Apr 2022 12:42:13 +0530 Subject: [PATCH] sched: walt: handle support for single and two cluster system Update walt_newidle load balance to support single and two cluster topology. Change-Id: Ic2bbbe7a273267c1a7aa340f9908b5e5325d21ba Signed-off-by: Ashay Jaiswal --- kernel/sched/walt/walt_lb.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/kernel/sched/walt/walt_lb.c b/kernel/sched/walt/walt_lb.c index 43beea4b55ab..a3020210bbc3 100644 --- a/kernel/sched/walt/walt_lb.c +++ b/kernel/sched/walt/walt_lb.c @@ -770,7 +770,7 @@ static void walt_newidle_balance(void *unused, struct rq *this_rq, int order_index; int busy_cpu = -1; bool enough_idle = (this_rq->avg_idle > NEWIDLE_BALANCE_THRESHOLD); - bool help_min_cap = false; + bool help_min_cap = false, find_next_cluster = false; int first_idle; int has_misfit = 0; @@ -828,6 +828,26 @@ static void walt_newidle_balance(void *unused, struct rq *this_rq, * can be queued remotely, so keep a check on nr_running * and bail out. */ + if (num_sched_clusters <= 2) { + busy_cpu = walt_lb_find_busiest_cpu(this_cpu, &cpu_array[order_index][0], + &has_misfit); + if (busy_cpu != -1) + goto found_busy_cpu; + + if (num_sched_clusters == 2) { + has_misfit = false; + find_next_cluster = (order_index == 0) ? enough_idle : 1; + if (find_next_cluster) { + busy_cpu = walt_lb_find_busiest_cpu(this_cpu, + &cpu_array[order_index][1], &has_misfit); + if (busy_cpu != -1 && (enough_idle || has_misfit)) + goto found_busy_cpu; + } + } + + goto unlock; + } + if (order_index == 0) { busy_cpu = walt_lb_find_busiest_cpu(this_cpu, &cpu_array[order_index][0], &has_misfit);