Skip to contentSkip to conversation

cpufreq: Fix a typo in comment

PATCH In review Namhyung Kim 2 participants 6 messages Feb 28, 2013 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 cpufreq: Fix a typo in comment

From: Namhyung Kim <[email protected]>

---
 drivers/cpufreq/cpufreq_governor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cpufreq_governor.h +1 -1
index d2ac91150600..46bde01eee62 100644
@@ -64,7 +64,7 @@ static void *get_cpu_dbs_info_s(int cpu)				\
  * dbs: used as a shortform for demand based switching It helps to keep variable
  *	names smaller, simpler
  * cdbs: common dbs
- * on_*: On-demand governor
+ * od_*: On-demand governor
  * cs_*: Conservative governor
  */
 
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 2/3 cpufreq: conservative: Break out earlier on the lowest frequency

From: Namhyung Kim <[email protected]>

If we're on the lowest frequency, no need to calculate new freq. Break out even earlier in this case.

---
 drivers/cpufreq/cpufreq_conservative.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/cpufreq/cpufreq_conservative.c +6 -6
index 4fd0006b1291..dd2fd9094819 100644
@@ -93,18 +93,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;
Signature · 1 line
1.7.11.7
#2 lore raw

PATCH 3/3 cpufreq: conservative: Fix relation when decreasing frequency

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

The relation should be CPUFREQ_RELATION_L to find optimal frequency when decreasing.

---
 drivers/cpufreq/cpufreq_conservative.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cpufreq_conservative.c +1 -1
index dd2fd9094819..0d582811d66c 100644
@@ -106,7 +106,7 @@ static void cs_check_cpu(int cpu, unsigned int load)
 			dbs_info->requested_freq = policy->min;
 
 		__cpufreq_driver_target(policy, dbs_info->requested_freq,
-				CPUFREQ_RELATION_H);
+				CPUFREQ_RELATION_L);
 		return;
 	}
 }
Signature · 1 line
1.7.11.7
maintainer
#3 lore raw

Re: [PATCH -next 3/3] cpufreq: conservative: Fix relation when decreasing frequency

Quoted 16 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

The relation should be CPUFREQ_RELATION_L to find optimal frequency when decreasing.

---
 drivers/cpufreq/cpufreq_conservative.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cpufreq_conservative.c +0 -0
index dd2fd9094819..0d582811d66c 100644

drivers/cpufreq/cpufreq_conservative.c static void cs_check_cpu(int cpu, unsigned int load) · line 109

Quoted 5 lines
drivers/cpufreq/cpufreq_conservative.c +1 -1
@@ -106,7 +106,7 @@ static void cs_check_cpu(int cpu, unsigned int load)
                        dbs_info->requested_freq = policy->min;
 
                __cpufreq_driver_target(policy, dbs_info->requested_freq,
-                               CPUFREQ_RELATION_H);
+                               CPUFREQ_RELATION_L);

Other two patches are fine but really not sure about this one. When decreasing freq, what do we want:
- lowest frequency at or above target, i.e. >= requested_freq
- highest frequency below or at target, i.e. <= requested_freq

I thought second option was better and so CPUFREQ_RELATION_H suits more. What made you do this change?

#4 lore raw

Re: [PATCH -next 3/3] cpufreq: conservative: Fix relation when decreasing frequency

Hi Viresh,

Quoted 28 lines · Viresh Kumar
Quoted 16 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

The relation should be CPUFREQ_RELATION_L to find optimal frequency when decreasing.

---
 drivers/cpufreq/cpufreq_conservative.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cpufreq_conservative.c +0 -0
index dd2fd9094819..0d582811d66c 100644

drivers/cpufreq/cpufreq_conservative.c static void cs_check_cpu(int cpu, unsigned int load) · line 109

Quoted 5 lines
drivers/cpufreq/cpufreq_conservative.c +1 -1
@@ -106,7 +106,7 @@ static void cs_check_cpu(int cpu, unsigned int load)
                        dbs_info->requested_freq = policy->min;
 
                __cpufreq_driver_target(policy, dbs_info->requested_freq,
-                               CPUFREQ_RELATION_H);
+                               CPUFREQ_RELATION_L);

Other two patches are fine but really not sure about this one. When decreasing freq, what do we want:
- lowest frequency at or above target, i.e. >= requested_freq
- highest frequency below or at target, i.e. <= requested_freq

Quoted 2 lines

I thought second option was better and so CPUFREQ_RELATION_H suits more. What made you do this change?

When decreasing, we were on a higher frequency than target so selecting above or equal to the target frequency seems to be "conservative". And AFAICS the ondemance governor also uses RELATION_L for decreasing.

Thanks,
Namhyung

maintainer Acked-by
#5 lore raw

Re: [PATCH -next 3/3] cpufreq: conservative: Fix relation when decreasing frequency

Quoted 2 lines · Namhyung Kim

When decreasing, we were on a higher frequency than target so selecting above or equal to the target frequency seems to be "conservative".

I will buy that. For all three patches: