Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1719493

[RFCv4 6/6] cpufreq: schedutil: add util clamp for RT/DL tasks

From Patrick Bellasi <patrick.bellasi@arm.com>
Newsgroups linux.kernel
Subject [RFCv4 6/6] cpufreq: schedutil: add util clamp for RT/DL tasks
Date 2017-08-24 20:20 +0200
Message-ID <ui4Tw-1Au-11@gated-at.bofh.it> (permalink)
References <ui4JP-1xk-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Currently schedutil enforces a maximum frequency when RT/DL tasks are
RUNNABLE.  Such a mandatory policy can be made more tunable from
userspace thus allowing for example to define a max frequency which is
still reasonable for the execution of a specific RT/DL workload. This
will contribute to make the RT class more friendly for power/energy
sensitive use-cases.

This patch extends the usage of util_{min,max} to the RT/DL classes.
Whenever a task in these classes is RUNNABLE, the util required is
defined by the constraints of the CPU control group the task belongs to.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org
---
 kernel/sched/cpufreq_schedutil.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index f67c26bbade4..feca60c107bc 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -227,7 +227,10 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
 	busy = sugov_cpu_is_busy(sg_cpu);
 
 	if (flags & SCHED_CPUFREQ_RT_DL) {
-		next_f = policy->cpuinfo.max_freq;
+		util = uclamp_util(smp_processor_id(), SCHED_CAPACITY_SCALE);
+		next_f = (uclamp_enabled && util < SCHED_CAPACITY_SCALE)
+			? get_next_freq(sg_policy, util, policy->cpuinfo.max_freq)
+			: policy->cpuinfo.max_freq;
 	} else {
 		sugov_get_util(&util, &max);
 		sugov_iowait_boost(sg_cpu, &util, &max);
@@ -276,10 +279,15 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, u64 time)
 			j_sg_cpu->iowait_boost = 0;
 			continue;
 		}
-		if (j_sg_cpu->flags & SCHED_CPUFREQ_RT_DL)
-			return policy->cpuinfo.max_freq;
 
-		j_util = j_sg_cpu->util;
+		if (j_sg_cpu->flags & SCHED_CPUFREQ_RT_DL) {
+			if (!uclamp_enabled)
+				return policy->cpuinfo.max_freq;
+			j_util = uclamp_util(j, SCHED_CAPACITY_SCALE);
+		} else {
+			j_util = j_sg_cpu->util;
+		}
+
 		j_max = j_sg_cpu->max;
 		if (j_util * max > j_max * util) {
 			util = j_util;
-- 
2.14.1

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RFCv4 0/6] Add utilization clamping to the CPU controller Patrick Bellasi <patrick.bellasi@arm.com> - 2017-08-24 20:10 +0200
  [RFCv4 5/6] cpufreq: schedutil: add util clamp for FAIR tasks Patrick Bellasi <patrick.bellasi@arm.com> - 2017-08-24 20:10 +0200
  [RFCv4 1/6] sched/core: add utilization clamping to CPU controller Patrick Bellasi <patrick.bellasi@arm.com> - 2017-08-24 20:10 +0200
  [RFCv4 2/6] sched/core: map cpu's task groups to clamp groups Patrick Bellasi <patrick.bellasi@arm.com> - 2017-08-24 20:10 +0200
  [RFCv4 6/6] cpufreq: schedutil: add util clamp for RT/DL tasks Patrick Bellasi <patrick.bellasi@arm.com> - 2017-08-24 20:20 +0200
  [RFCv4 3/6] sched/core: reference count active tasks's clamp groups Patrick Bellasi <patrick.bellasi@arm.com> - 2017-08-24 20:20 +0200
  [RFCv4 4/6] sched/core: sync task_group's with CPU's clamp groups Patrick Bellasi <patrick.bellasi@arm.com> - 2017-08-24 20:20 +0200

csiph-web