cpufreq: conservative: Break out earlier on the lowest frequency
authorNamhyung Kim <namhyung.kim@lge.com>
Thu, 28 Feb 2013 05:38:01 +0000 (05:38 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 31 Mar 2013 23:11:35 +0000 (01:11 +0200)
If we're on the lowest frequency, no need to calculate new freq.
Break out even earlier in this case.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq_conservative.c

index 6fe6050a3889b556a621417025a1108496d97cdb..302931e76842dd940e9f830659591c87d0d1190e 100644 (file)
@@ -87,18 +87,18 @@ static void cs_check_cpu(int cpu, unsigned int load)
         * safe, we focus 10 points under the threshold.
         */
        if (load < (cs_tuners->down_threshold - 10)) {
-               freq_target = (cs_tuners->freq_step * policy->max) / 100;
-
-               dbs_info->requested_freq -= freq_target;
-               if (dbs_info->requested_freq < policy->min)
-                       dbs_info->requested_freq = policy->min;
-
                /*
                 * if we cannot reduce the frequency anymore, break out early
                 */
                if (policy->cur == policy->min)
                        return;
 
+               freq_target = (cs_tuners->freq_step * policy->max) / 100;
+
+               dbs_info->requested_freq -= freq_target;
+               if (dbs_info->requested_freq < policy->min)
+                       dbs_info->requested_freq = policy->min;
+
                __cpufreq_driver_target(policy, dbs_info->requested_freq,
                                CPUFREQ_RELATION_H);
                return;