cpufreq: conservative: Fix sampling_down_factor functionality
authorStratos Karafotis <stratosk@semaphore.gr>
Tue, 5 Mar 2013 22:06:29 +0000 (22:06 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 31 Mar 2013 23:11:35 +0000 (01:11 +0200)
sampling_down_factor tunable is unused since commit
8e677ce83bf41ba9c74e5b6d9ee60b07d4e5ed93 (4 years ago).

This patch restores the original functionality and documents the
tunable.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Documentation/cpu-freq/governors.txt
drivers/cpufreq/cpufreq_conservative.c

index c7a2eb8450c226b50e55b28f8c6669c6041cc0e3..4dfed30b7fda44233ae4de363176d957cce12c77 100644 (file)
@@ -191,6 +191,12 @@ governor but for the opposite direction.  For example when set to its
 default value of '20' it means that if the CPU usage needs to be below
 20% between samples to have the frequency decreased.
 
+sampling_down_factor: similar functionality as in "ondemand" governor.
+But in "conservative", it controls the rate at which the kernel makes
+a decision on when to decrease the frequency while running in any
+speed. Load for frequency increase is still evaluated every
+sampling rate.
+
 3. The Governor Interface in the CPUfreq Core
 =============================================
 
index 52f76b19a883b6833fd4800ff6f7dcaf08b37d23..d746d6abbca8a04f703072f0241a8129e6b7c4d0 100644 (file)
@@ -36,9 +36,9 @@ static DEFINE_PER_CPU(struct cs_cpu_dbs_info_s, cs_cpu_dbs_info);
 
 /*
  * Every sampling_rate, we check, if current idle time is less than 20%
- * (default), then we try to increase frequency Every sampling_rate *
- * sampling_down_factor, we check, if current idle time is more than 80%, then
- * we try to decrease frequency
+ * (default), then we try to increase frequency. Every sampling_rate *
+ * sampling_down_factor, we check, if current idle time is more than 80%
+ * (default), then we try to decrease frequency
  *
  * Any frequency increase takes it to the maximum frequency. Frequency reduction
  * happens at minimum steps of 5% (default) of maximum frequency
@@ -81,6 +81,11 @@ static void cs_check_cpu(int cpu, unsigned int load)
                return;
        }
 
+       /* if sampling_down_factor is active break out early */
+       if (++dbs_info->down_skip < cs_tuners->sampling_down_factor)
+               return;
+       dbs_info->down_skip = 0;
+
        /*
         * The optimal frequency is the frequency that is the lowest that can
         * support the current CPU usage without triggering the up policy. To be