From 8e9d3d0740c7fb84d31c65ad745efca0bf0fb09d Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Fri, 16 Aug 2019 10:30:58 +0100 Subject: [PATCH] ANDROID: sched/fair: Cap transient util in stune boosted_cpu_util() sums the CFS and RT util signals before they are used for frequency selection. While the util_avg signals are in sync, util_est prevents cpu_util_cfs() from decreasing when a CFS task is preempted by RT. This util_est behaviour is beneficial in many scenarios, but it can cause the sum of rt_util and cfs_util to go above SCHED_CAPACITY_SCALE. Although benign, this transient value appears in the stune tracepoints, and can cause confusion. Work around the problem by capping the util sum to SCHED_CAPACITY_SCALE. Bug: 120440300 Change-Id: I2be6eb157af86024e52ae11715f5637c77b201a3 Signed-off-by: Quentin Perret --- kernel/sched/fair.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5975d1481154..efdf4e201582 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5922,7 +5922,8 @@ schedtune_task_margin(struct task_struct *task) unsigned long boosted_cpu_util(int cpu, unsigned long other_util) { - unsigned long util = cpu_util_cfs(cpu_rq(cpu)) + other_util; + unsigned long util = min_t(unsigned long, SCHED_CAPACITY_SCALE, + cpu_util_cfs(cpu_rq(cpu)) + other_util); long margin = schedtune_cpu_margin(util, cpu); trace_sched_boost_cpu(cpu, util, margin);