From 87f1fd9d3458b6e7a18dcacf685561dd8a5a9a03 Mon Sep 17 00:00:00 2001 From: Abhijeet Dharmapurikar Date: Thu, 22 Sep 2022 15:00:47 -0700 Subject: [PATCH] sched/walt: fix handling of up/down migrate The code currently unnecessarily checks for cap_margin_levels > 1. In SMP systems where num_sched_clusters = 1 we still use a single sched_cluster with all the cpus. So we dont have to handle num_sched_cluster =1 (or 2) separately. Change-Id: Ie9a8dda70555f02d64df11b310fd56727f149633 Signed-off-by: Abhijeet Dharmapurikar --- kernel/sched/walt/sysctl.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/kernel/sched/walt/sysctl.c b/kernel/sched/walt/sysctl.c index 38b0c731eae4..896ee8fd6759 100644 --- a/kernel/sched/walt/sysctl.c +++ b/kernel/sched/walt/sysctl.c @@ -365,39 +365,25 @@ static void sched_update_updown_migrate_values(bool up) { int i = 0, cpu; struct walt_sched_cluster *cluster; - int cap_margin_levels = num_sched_clusters - 1; - if (cap_margin_levels > 1) { + for_each_sched_cluster(cluster) { /* * No need to worry about CPUs in last cluster * if there are more than 2 clusters in the system */ - for_each_sched_cluster(cluster) { - for_each_cpu(cpu, &cluster->cpus) { - if (up) - sched_capacity_margin_up[cpu] = - SCHED_FIXEDPOINT_SCALE * 100 / - sysctl_sched_capacity_margin_up_pct[i]; - else - sched_capacity_margin_down[cpu] = - SCHED_FIXEDPOINT_SCALE * 100 / - sysctl_sched_capacity_margin_dn_pct[i]; - } - - if (++i >= cap_margin_levels) - break; - } - } else { - for_each_possible_cpu(cpu) { + for_each_cpu(cpu, &cluster->cpus) { if (up) sched_capacity_margin_up[cpu] = - SCHED_FIXEDPOINT_SCALE * 100 / - sysctl_sched_capacity_margin_up_pct[0]; + sysctl_sched_capacity_margin_up_pct[i]; else sched_capacity_margin_down[cpu] = - sysctl_sched_capacity_margin_dn_pct[0]; + SCHED_FIXEDPOINT_SCALE * 100 / + sysctl_sched_capacity_margin_dn_pct[i]; } + + if (++i >= num_sched_clusters - 1) + break; } }