From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM list <linux-pm@vger.kernel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/5] cpufreq: governor: Check transition latecy at init time only
Date: Sat, 14 May 2016 01:00:28 +0200 [thread overview]
Message-ID: <8685194.VWxfunzal1@vostro.rjw.lan> (raw)
In-Reply-To: <10707470.yIcqGAzuFY@vostro.rjw.lan>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
It is not necessary to check the governor's max_transition_latency
attribute every time cpufreq_governor() runs, so check it only if
the event argument is CPUFREQ_GOV_POLICY_INIT.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/cpufreq.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
Index: linux-pm/drivers/cpufreq/cpufreq.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/cpufreq.c
+++ linux-pm/drivers/cpufreq/cpufreq.c
@@ -2011,23 +2011,24 @@ static int cpufreq_governor(struct cpufr
if (!policy->governor)
return -EINVAL;
- if (policy->governor->max_transition_latency &&
- policy->cpuinfo.transition_latency >
- policy->governor->max_transition_latency) {
- struct cpufreq_governor *gov = cpufreq_fallback_governor();
+ if (event == CPUFREQ_GOV_POLICY_INIT) {
+ if (policy->governor->max_transition_latency &&
+ policy->cpuinfo.transition_latency >
+ policy->governor->max_transition_latency) {
+ struct cpufreq_governor *gov = cpufreq_fallback_governor();
- if (gov) {
- pr_warn("%s governor failed, too long transition latency of HW, fallback to %s governor\n",
- policy->governor->name, gov->name);
- policy->governor = gov;
- } else {
- return -EINVAL;
+ if (gov) {
+ pr_warn("%s governor failed, too long transition latency of HW, fallback to %s governor\n",
+ policy->governor->name, gov->name);
+ policy->governor = gov;
+ } else {
+ return -EINVAL;
+ }
}
- }
- if (event == CPUFREQ_GOV_POLICY_INIT)
if (!try_module_get(policy->governor->owner))
return -EINVAL;
+ }
pr_debug("%s: for CPU %u, event %u\n", __func__, policy->cpu, event);
next prev parent reply other threads:[~2016-05-13 23:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 22:58 [PATCH 0/5] cpufreq: governor: Rework API to use callbacks instead of events Rafael J. Wysocki
2016-05-13 22:59 ` [PATCH 1/5] cpufreq: governor: CPUFREQ_GOV_LIMITS never fails Rafael J. Wysocki
2016-05-13 23:00 ` Rafael J. Wysocki [this message]
2016-05-13 23:01 ` [PATCH 3/5] cpufreq: governor: Simplify performance and powersave governors Rafael J. Wysocki
2016-05-13 23:01 ` [PATCH 4/5] cpufreq: Split cpufreq_governor() into simpler functions Rafael J. Wysocki
2016-05-13 23:02 ` [PATCH 5/5] cpufreq: governor: Get rid of governor events Rafael J. Wysocki
2016-05-16 4:54 ` Viresh Kumar
2016-05-16 4:55 ` [PATCH 0/5] cpufreq: governor: Rework API to use callbacks instead of events Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8685194.VWxfunzal1@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox