From 0e90c114dd08b24975329a4047c8d847f5d26ab7 Mon Sep 17 00:00:00 2001 From: Lingutla Chandrasekhar Date: Tue, 24 Aug 2021 14:00:06 +0530 Subject: [PATCH] sched: walt: Account rt scale to cpu_capacity While updating cpu_rq->cpu_capacity, we are ignoring rt pressure, and using same as cpu_capacity_orig, which might lead to unfair scheduler decisions. Fix it by accouting rt scale to cpu_capacity. Change-Id: Icead0af0d8a309cc5f93438a4d4d7e7e7c93653c Signed-off-by: Lingutla Chandrasekhar --- kernel/sched/walt/walt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/walt/walt.c b/kernel/sched/walt/walt.c index f3fa92fdbc7f..367521dea565 100644 --- a/kernel/sched/walt/walt.c +++ b/kernel/sched/walt/walt.c @@ -3717,6 +3717,7 @@ static void android_rvh_update_cpu_capacity(void *unused, int cpu, unsigned long unsigned long thermal_pressure = arch_scale_thermal_pressure(cpu); unsigned long thermal_cap; struct walt_sched_cluster *cluster; + unsigned long rt_pressure = max_capacity - *capacity; if (unlikely(walt_disabled)) return; @@ -3736,7 +3737,7 @@ static void android_rvh_update_cpu_capacity(void *unused, int cpu, unsigned long cluster->max_possible_freq); cpu_rq(cpu)->cpu_capacity_orig = min(max_capacity, thermal_cap); - *capacity = cpu_rq(cpu)->cpu_capacity_orig; + *capacity = cpu_rq(cpu)->cpu_capacity_orig - rt_pressure; } static void android_rvh_sched_cpu_starting(void *unused, int cpu)