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


Groups > linux.kernel > #1401026

[PATCH 2/5] cpufreq: governor: Check transition latecy at init time only

From "Rafael J. Wysocki" <rjw@rjwysocki.net>
Newsgroups linux.kernel
Subject [PATCH 2/5] cpufreq: governor: Check transition latecy at init time only
Date 2016-05-14 01:00 +0200
Message-ID <ryudP-4h8-13@gated-at.bofh.it> (permalink)
References <ryudP-4h8-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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);
 

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


Thread

[PATCH 0/5] cpufreq: governor: Rework API to use callbacks instead of events "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-14 01:00 +0200
  [PATCH 2/5] cpufreq: governor: Check transition latecy at init time only "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-14 01:00 +0200
  [PATCH 5/5] cpufreq: governor: Get rid of governor events "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-14 01:10 +0200
    Re: [PATCH 5/5] cpufreq: governor: Get rid of governor events Viresh Kumar <viresh.kumar@linaro.org> - 2016-05-16 07:00 +0200
  [PATCH 4/5] cpufreq: Split cpufreq_governor() into simpler functions "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-14 01:10 +0200
  Re: [PATCH 0/5] cpufreq: governor: Rework API to use callbacks  instead of events Viresh Kumar <viresh.kumar@linaro.org> - 2016-05-16 07:00 +0200

csiph-web