Skip to contentSkip to conversation

(2/3) cpufreq_ondemand - 02_check-rate-and-break-out.diff

PATCH New Alexander Clouter 1 participant 1 message Feb 20, 2005 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (2/3) cpufreq_ondemand - 02_check-rate-and-break-out.diff

Prevents un-necessary cpufreq changes if we are already at min/max

Signature · 9 lines
 _________________________________________ 
/ He who lives without folly is less wise \
\ than he believes.                       /
 ----------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
drivers/cpufreq/cpufreq_ondemand.c +8 -0
@@ -334,6 +334,10 @@
 			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate);
 
 	if (idle_ticks < up_idle_ticks) {
+		/* if we are already at full speed then break out early */
+		if (policy->cur == policy->max)
+			return;
+		
 		__cpufreq_driver_target(policy, policy->max, 
 			CPUFREQ_RELATION_H);
 		down_skip[cpu] = 0;
@@ -387,6 +391,10 @@
 			sampling_rate_in_HZ(freq_down_sampling_rate);
 
 	if (idle_ticks > down_idle_ticks ) {
+		/* if we are already at the lowest speed then break out early */
+		if (policy->cur == policy->min)
+			return;
+		
 		freq_down_step = (5 * policy->max) / 100;
 
 		/* max freq cannot be less than 100. But who knows.... */

_______________________________________________
Cpufreq mailing list
[email protected]
http://lists.linux.org.uk/mailman/listinfo/cpufreq