From e453c52b947749f2d565ae6adb790618d60d7f6e Mon Sep 17 00:00:00 2001 From: Shaleen Agrawal Date: Wed, 26 Jul 2023 10:26:01 -0700 Subject: [PATCH] sched/walt: Adjust cpu clusters for mid cap CPUs In the event of a 4 cluster system, where gold- cluster has a lower max capacity than gold cluster, ensure the ordering of the 4 cluster system is maintained in the preset order. Change-Id: Iff6cfb9ad93917c8b5ee94986165fabdf92b7c57 Signed-off-by: Shaleen Agrawal --- kernel/sched/walt/walt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/sched/walt/walt.c b/kernel/sched/walt/walt.c index c6aa9f5dd81e..f73aa4145523 100644 --- a/kernel/sched/walt/walt.c +++ b/kernel/sched/walt/walt.c @@ -2583,6 +2583,19 @@ static inline void assign_cluster_ids(struct list_head *head) sched_cluster[pos++] = cluster; } + if (pos == 4) { + if (arch_scale_cpu_capacity( + cpumask_first(&sched_cluster[1]->cpus)) < + arch_scale_cpu_capacity( + cpumask_first(&sched_cluster[2]->cpus))) { + cluster = sched_cluster[2]; + sched_cluster[2] = sched_cluster[1]; + sched_cluster[1] = cluster; + sched_cluster[1]->id = 2; + sched_cluster[2]->id = 1; + } + } + WARN_ON(pos > MAX_CLUSTERS); }