From 5f23c8fec1043b20a7dcd3f4de91e06e55561e0b Mon Sep 17 00:00:00 2001 From: Kyle Lin Date: Wed, 12 Feb 2020 17:48:00 +0800 Subject: [PATCH] kernel: sched: account for real time utilization PELT doesn't account for real time task utilization in cpu_util(). As the result a CPU busy running RT task is considered as low utilization by the scheduler. Fix this by adding real time loading in to account. Bug: 147385228 Test: boot to home and run audio test Change-Id: Ie4412b186608b9a618f0d35cee9a7310db481f7c Signed-off-by: Kyle Lin Signed-off-by: Alexander Winkowski --- kernel/sched/sched.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index fb83291d6a3a..86d6905d507b 100755 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2043,7 +2043,12 @@ static inline unsigned long task_util(struct task_struct *p) * * Return: the (estimated) utilization for the specified CPU */ + +#ifdef CONFIG_SCHED_WALT static inline unsigned long cpu_util(int cpu) +#else +static inline unsigned long __cpu_util(int cpu) +#endif { struct cfs_rq *cfs_rq; unsigned int util; @@ -2150,12 +2155,18 @@ static inline unsigned long cpu_util_rt(int cpu) return rt_rq->avg.util_avg; } +static inline unsigned long cpu_util(int cpu) +{ + return min(__cpu_util(cpu) + cpu_util_rt(cpu), capacity_orig_of(cpu)); +} + static inline unsigned long cpu_util_freq(int cpu, struct sched_walt_cpu_load *walt_load) { - return min(cpu_util(cpu) + cpu_util_rt(cpu), capacity_orig_of(cpu)); + return min(cpu_util(cpu), capacity_orig_of(cpu)); } + #define sched_ravg_window TICK_NSEC #define sysctl_sched_use_walt_cpu_util 0