Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1686256
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Viresh Kumar <viresh.kumar@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | [RFC V2 4/6] cpufreq: Use transition_delay_us for legacy governors as well |
| Date | Thu, 13 Jul 2017 07:50:01 +0200 |
| Message-ID | <u2FaF-1xh-7@gated-at.bofh.it> (permalink) |
| References | <u2FaF-1xh-3@gated-at.bofh.it> |
| X-Original-To | Rafael Wysocki <rjw@rjwysocki.net>, Viresh Kumar <viresh.kumar@linaro.org>, Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=fZFhdv4UgjIZaOVNkdCddKMuuvsYjBL6fiaiiiF+VZc=; b=Fy7BPdYK9DbnDL9wWB0htBcmlq4EIejR0kdXkF5fSOdev8fJTTOwdEjRR1ZkWowN0P J01BKf6HeMjRwHXNy9A32CoN6HRVxtCLRwPg1iVUx7I1YFGt7bcNQZTBSmGko+vj0nAh uEf3KtA79AuPjBGo2lWIet1lc/qvrOYhpU8lQ= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=fZFhdv4UgjIZaOVNkdCddKMuuvsYjBL6fiaiiiF+VZc=; b=M3L/SZ1GtLWSIlpri5kxdwfcg+3M+QB0LiLA40eDtXmJMknfKHKOG3jPg+xGr9paWX VihuNbsXk2sTWUq/jBQACHMJ6kWH1SbskQnXd65Z/6F4hlHijDdEo+333Zd9mjkBwfnR pkU5CE4MEIV5nACnySWJ5hEllL3kubuF8vYEX+hbK0b17MC+zu1nOPh2+Olo9mKFLzfV 6hsCmF4RGkmfgMj+U9c41ACcIXQRSUaOek+EqAOovO3Nt5sDE9hOUXopTKtKwli3fZpc YgGd1ZW4gRjUi1cAG9LCDeT/ncvYX2MnoFmw7gnrGOheMCtvamN9ETpk/cQVbItWShYP VkWw== |
| X-Gm-Message-State | AIVw111Z/+ku8+G+LwoRI5hLa4pVtBheH2jcAJq4QI7XVJLaMT1V/K5f pf9UmnpPHmTenGF6 |
| X-Received | by 10.99.165.82 with SMTP id r18mr7657344pgu.65.1499924501748; Wed, 12 Jul 2017 22:41:41 -0700 (PDT) |
| X-Mailer | git-send-email 2.13.0.71.gd7076ec9c9cb |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 93 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-pm@vger.kernel.org, Vincent Guittot <vincent.guittot@linaro.org>, linux@dominikbrodowski.net, linux-kernel@vger.kernel.org |
| X-Original-Date | Thu, 13 Jul 2017 11:10:55 +0530 |
| X-Original-Message-ID | <2b3bfd2566ecaa0635c29a49c110e16803f80db0.1499853492.git.viresh.kumar@linaro.org> |
| X-Original-References | <cover.1499853492.git.viresh.kumar@linaro.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1686256 |
Show key headers only | View raw
The policy->transition_delay_us field is used only by the schedutil
governor currently, and this field describes how fast the driver wants
the cpufreq governor to change CPUs frequency. It should rather be a
common thing across all governors, as it doesn't have any schedutil
dependency here.
Create a new helper cpufreq_policy_transition_delay_us() to get the
transition delay across all governors.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq_governor.c | 9 +--------
include/linux/cpufreq.h | 15 +++++++++++++++
kernel/sched/cpufreq_schedutil.c | 11 +----------
3 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index 858081f9c3d7..eed069ecfd5e 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -389,7 +389,6 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
struct dbs_governor *gov = dbs_governor_of(policy);
struct dbs_data *dbs_data;
struct policy_dbs_info *policy_dbs;
- unsigned int latency;
int ret = 0;
/* State should be equivalent to EXIT */
@@ -428,13 +427,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
if (ret)
goto free_policy_dbs_info;
- /* policy latency is in ns. Convert it to us first */
- latency = policy->cpuinfo.transition_latency / 1000;
- if (latency == 0)
- latency = 1;
-
- /* Bring kernel and HW constraints together */
- dbs_data->sampling_rate = LATENCY_MULTIPLIER * latency;
+ dbs_data->sampling_rate = cpufreq_policy_transition_delay_us(policy);
if (!have_governor_per_policy())
gov->gdbs_data = dbs_data;
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 00e4c40a3249..14f0ab61ed17 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -532,6 +532,21 @@ static inline void cpufreq_policy_apply_limits(struct cpufreq_policy *policy)
__cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L);
}
+static inline unsigned int
+cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy)
+{
+ unsigned int delay_us = LATENCY_MULTIPLIER, latency;
+
+ if (policy->transition_delay_us)
+ return policy->transition_delay_us;
+
+ latency = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
+ if (latency)
+ delay_us *= latency;
+
+ return delay_us;
+}
+
/* Governor attribute set */
struct gov_attr_set {
struct kobject kobj;
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index ab9d7a1b43dc..5c72c569ec2f 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -528,16 +528,7 @@ static int sugov_init(struct cpufreq_policy *policy)
goto stop_kthread;
}
- if (policy->transition_delay_us) {
- tunables->rate_limit_us = policy->transition_delay_us;
- } else {
- unsigned int lat;
-
- tunables->rate_limit_us = LATENCY_MULTIPLIER;
- lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
- if (lat)
- tunables->rate_limit_us *= lat;
- }
+ tunables->rate_limit_us = cpufreq_policy_transition_delay_us(policy);
policy->governor_data = sg_policy;
sg_policy->tunables = tunables;
--
2.13.0.71.gd7076ec9c9cb
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[RFC V2 4/6] cpufreq: Use transition_delay_us for legacy governors as well Viresh Kumar <viresh.kumar@linaro.org> - 2017-07-13 07:50 +0200 Re: [RFC V2 4/6] cpufreq: Use transition_delay_us for legacy governors as well "Rafael J. Wysocki" <rafael@kernel.org> - 2017-07-13 18:40 +0200
csiph-web