From ad271f2d0d7e222b5720931ffc73c4e45cc06c71 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Tue, 10 Jul 2018 15:44:09 +0100 Subject: [PATCH] ANDROID: cpufreq/schedutil: Select frequency using util_avg for RT Schedutil always requests max frequency whenever a RT task is running. Now that we have a better estimate of the utilization of RT runqueues, it is possible to make a less conservative decision and scale frequency according to the needs of the RT tasks. To do so, protect the RT-go-to-max code with a new sched_feature. The sched_feature is disabled by default, hence favoring energy savings as required in mobile environments. Signed-off-by: Quentin Perret Change-Id: Ic9f01c8703d4f843addaa0d684012a422fe9f3b8 --- kernel/sched/cpufreq_schedutil.c | 3 ++- kernel/sched/features.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 20ad939e143d..56881d416449 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -204,7 +204,8 @@ unsigned long schedutil_freq_util(int cpu, unsigned long util_cfs, struct rq *rq = cpu_rq(cpu); unsigned long util, irq; - if (type == FREQUENCY_UTIL && rt_rq_is_runnable(&rq->rt)) + if (sched_feat(SUGOV_RT_MAX_FREQ) && type == FREQUENCY_UTIL && + rt_rq_is_runnable(&rq->rt)) return max; /* diff --git a/kernel/sched/features.h b/kernel/sched/features.h index 0232a4570b78..5590f47a6e78 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -104,3 +104,8 @@ SCHED_FEAT(FIND_BEST_TARGET, true) * those tasks through the mainline slow path. */ SCHED_FEAT(EAS_PREFER_IDLE, true) + +/* + * Request max frequency from schedutil whenever a RT task is running. + */ +SCHED_FEAT(SUGOV_RT_MAX_FREQ, false)