[tip:sched/core] sched/cpufreq: Always consider all CPUs when deciding next freq

From: tip-bot for Juri Lelli
Date: Wed Jan 10 2018 - 07:24:02 EST


Commit-ID: 0fa7d181f1a60149061632266bb432b4b61acdac
Gitweb: https://git.kernel.org/tip/0fa7d181f1a60149061632266bb432b4b61acdac
Author: Juri Lelli <juri.lelli@xxxxxxx>
AuthorDate: Mon, 4 Dec 2017 11:23:22 +0100
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Wed, 10 Jan 2018 12:53:34 +0100

sched/cpufreq: Always consider all CPUs when deciding next freq

No assumption can be made upon the rate at which frequency updates get
triggered, as there are scheduling policies (like SCHED_DEADLINE) which
don't trigger them so frequently.

Remove such assumption from the code, by always considering
SCHED_DEADLINE utilization signal as not stale.

Signed-off-by: Juri Lelli <juri.lelli@xxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Cc: Claudio Scordino <claudio@xxxxxxxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Luca Abeni <luca.abeni@xxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Rafael J . Wysocki <rafael.j.wysocki@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: alessio.balsini@xxxxxxx
Cc: bristot@xxxxxxxxxx
Cc: dietmar.eggemann@xxxxxxx
Cc: joelaf@xxxxxxxxxx
Cc: juri.lelli@xxxxxxxxxx
Cc: mathieu.poirier@xxxxxxxxxx
Cc: morten.rasmussen@xxxxxxx
Cc: patrick.bellasi@xxxxxxx
Cc: rjw@xxxxxxxxxxxxx
Cc: rostedt@xxxxxxxxxxx
Cc: tkjos@xxxxxxxxxxx
Cc: tommaso.cucinotta@xxxxxxxxxxxxxxx
Cc: vincent.guittot@xxxxxxxxxx
Link: http://lkml.kernel.org/r/20171204102325.5110-6-juri.lelli@xxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
kernel/sched/cpufreq_schedutil.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index e9e0713..dd062a1 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -315,17 +315,21 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, u64 time)
s64 delta_ns;

/*
- * If the CPU utilization was last updated before the previous
- * frequency update and the time elapsed between the last update
- * of the CPU utilization and the last frequency update is long
- * enough, don't take the CPU into account as it probably is
- * idle now (and clear iowait_boost for it).
+ * If the CFS CPU utilization was last updated before the
+ * previous frequency update and the time elapsed between the
+ * last update of the CPU utilization and the last frequency
+ * update is long enough, reset iowait_boost and util_cfs, as
+ * they are now probably stale. However, still consider the
+ * CPU contribution if it has some DEADLINE utilization
+ * (util_dl).
*/
delta_ns = time - j_sg_cpu->last_update;
if (delta_ns > TICK_NSEC) {
j_sg_cpu->iowait_boost = 0;
j_sg_cpu->iowait_boost_pending = false;
- continue;
+ j_sg_cpu->util_cfs = 0;
+ if (j_sg_cpu->util_dl == 0)
+ continue;
}
if (j_sg_cpu->flags & SCHED_CPUFREQ_RT)
return policy->cpuinfo.max_freq;