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
Bug: 160663228
Bug: 162213449
Bug: 160663228
Test: boot to home and run audio test

Change-Id: Ie4412b186608b9a618f0d35cee9a7310db481f7c
Signed-off-by: Kyle Lin <kylelin@google.com>
(cherry picked from commit 8bc7fc013391af48aea7d0556bacb144a7328c30)
This commit is contained in:
Kyle Lin 2020-02-12 17:48:00 +08:00 committed by spakkkk
parent d31aa4ff20
commit f2ae9c47a3

View File

@ -2231,7 +2231,13 @@ 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);
static inline unsigned long __cpu_util(int cpu)
#endif
{
struct cfs_rq *cfs_rq;
unsigned int util;
@ -2741,8 +2747,23 @@ static inline unsigned long schedutil_cpu_util(int cpu, unsigned long util_cfs,
{
return 0;
}
static inline unsigned long cpu_util_rt(struct rq *rq)
{
return 0;
}
#endif /* CONFIG_CPU_FREQ_GOV_SCHEDUTIL */
#ifdef CONFIG_SMP
#ifndef CONFIG_SCHED_WALT
static inline unsigned long cpu_util(int cpu)
{
return min(__cpu_util(cpu) + cpu_util_rt(cpu_rq(cpu)),
capacity_orig_of(cpu));
}
#endif
#endif
#ifdef CONFIG_HAVE_SCHED_AVG_IRQ
static inline unsigned long cpu_util_irq(struct rq *rq)
{