All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: schedutil: rate limits for SCHED_DEADLINE
@ 2018-02-08 17:01 Claudio Scordino
  2018-02-09  3:51 ` Viresh Kumar
  2018-02-09 11:14 ` Rafael J. Wysocki
  0 siblings, 2 replies; 16+ messages in thread
From: Claudio Scordino @ 2018-02-08 17:01 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Claudio Scordino, Rafael J . Wysocki, Patrick Bellasi,
	Dietmar Eggemann, Morten Rasmussen, Juri Lelli, Viresh Kumar,
	Vincent Guittot, Todd Kjos, Joel Fernandes, linux-pm,
	linux-kernel

When the SCHED_DEADLINE scheduling class increases the CPU utilization,
we should not wait for the rate limit, otherwise we may miss some deadline.

Tests using rt-app on Exynos5422 have shown reductions of about 10% of deadline
misses for tasks with low RT periods.

The patch applies on top of the one recently proposed by Peter to drop the
SCHED_CPUFREQ_* flags.

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
CC: Rafael J . Wysocki <rafael.j.wysocki@intel.com>
CC: Patrick Bellasi <patrick.bellasi@arm.com>
CC: Dietmar Eggemann <dietmar.eggemann@arm.com>
CC: Morten Rasmussen <morten.rasmussen@arm.com>
CC: Juri Lelli <juri.lelli@redhat.com>
CC: Viresh Kumar <viresh.kumar@linaro.org>
CC: Vincent Guittot <vincent.guittot@linaro.org>
CC: Todd Kjos <tkjos@android.com>
CC: Joel Fernandes <joelaf@google.com>
CC: linux-pm@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 kernel/sched/cpufreq_schedutil.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index b0bd77d..d8dcba2 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -74,7 +74,10 @@ static DEFINE_PER_CPU(struct sugov_cpu, sugov_cpu);
 
 /************************ Governor internals ***********************/
 
-static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
+static bool sugov_should_update_freq(struct sugov_policy *sg_policy,
+				     u64 time,
+				     struct sugov_cpu *sg_cpu_old,
+				     struct sugov_cpu *sg_cpu_new)
 {
 	s64 delta_ns;
 
@@ -111,6 +114,10 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
 		return true;
 	}
 
+	/* Ignore rate limit when DL increased utilization. */
+	if (sg_cpu_new->util_dl > sg_cpu_old->util_dl)
+		return true;
+
 	delta_ns = time - sg_policy->last_freq_update_time;
 	return delta_ns >= sg_policy->freq_update_delay_ns;
 }
@@ -271,6 +278,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
 				unsigned int flags)
 {
 	struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util);
+	struct sugov_cpu sg_cpu_old = *sg_cpu;
 	struct sugov_policy *sg_policy = sg_cpu->sg_policy;
 	unsigned long util, max;
 	unsigned int next_f;
@@ -279,7 +287,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
 	sugov_set_iowait_boost(sg_cpu, time, flags);
 	sg_cpu->last_update = time;
 
-	if (!sugov_should_update_freq(sg_policy, time))
+	if (!sugov_should_update_freq(sg_policy, time, &sg_cpu_old, sg_cpu))
 		return;
 
 	busy = sugov_cpu_is_busy(sg_cpu);
@@ -350,6 +358,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time,
 				unsigned int flags)
 {
 	struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util);
+	struct sugov_cpu sg_cpu_old = *sg_cpu;
 	struct sugov_policy *sg_policy = sg_cpu->sg_policy;
 	unsigned int next_f;
 
@@ -359,7 +368,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time,
 	sugov_set_iowait_boost(sg_cpu, time, flags);
 	sg_cpu->last_update = time;
 
-	if (sugov_should_update_freq(sg_policy, time)) {
+	if (sugov_should_update_freq(sg_policy, time, &sg_cpu_old, sg_cpu)) {
 		next_f = sugov_next_freq_shared(sg_cpu, time);
 		sugov_update_commit(sg_policy, time, next_f);
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-02-09 13:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 17:01 [PATCH] cpufreq: schedutil: rate limits for SCHED_DEADLINE Claudio Scordino
2018-02-09  3:51 ` Viresh Kumar
2018-02-09  8:02   ` Claudio Scordino
2018-02-09  8:40     ` Viresh Kumar
2018-02-09 10:36     ` Rafael J. Wysocki
2018-02-09 10:53       ` Juri Lelli
2018-02-09 11:04         ` Rafael J. Wysocki
2018-02-09 11:26           ` Juri Lelli
2018-02-09 11:37             ` Rafael J. Wysocki
2018-02-09 11:51               ` Juri Lelli
2018-02-09 12:08                 ` Rafael J. Wysocki
2018-02-09 12:52                   ` Juri Lelli
2018-02-09 12:56                     ` Rafael J. Wysocki
2018-02-09 13:20                       ` Claudio Scordino
2018-02-09 13:25                       ` Juri Lelli
2018-02-09 11:14 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.