Skip to contentSkip to conversation

cpufreq: conservative: Fix sampling_down_factor functionality

PATCH In review Stratos Karafotis 2 participants 2 messages Mar 5, 2013 – Mar 6, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 cpufreq: conservative: Fix sampling_down_factor functionality

sampling_down_factor tunable is unused since commit 8e677ce83bf41ba9c74e5b6d9ee60b07d4e5ed93 (4 years ago).

This patch restores the original functionality and documents the tunable.

---
 Documentation/cpu-freq/governors.txt   |  6 ++++++
 drivers/cpufreq/cpufreq_conservative.c | 11 ++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
Documentation/cpu-freq/governors.txt +6 -0
index c7a2eb8..4dfed30 100644
@@ -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
 =============================================
 
drivers/cpufreq/cpufreq_conservative.c +8 -3
index 4fd0006..1e3be56 100644
@@ -44,9 +44,9 @@ static struct cs_dbs_tuners cs_tuners = {
 
 /*
  * 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
@@ -87,6 +87,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
Signature · 1 line
1.8.1.4
maintainer Acked-by on v1 1/3
#1 lore raw
Quoted 11 lines · Stratos Karafotis

sampling_down_factor tunable is unused since commit 8e677ce83bf41ba9c74e5b6d9ee60b07d4e5ed93 (4 years ago).

This patch restores the original functionality and documents the tunable.

---
 Documentation/cpu-freq/governors.txt   |  6 ++++++
 drivers/cpufreq/cpufreq_conservative.c | 11 ++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)