Skip to contentSkip to conversation

(1/1) cpufreq_conservative - cpufreq_conservative-2.6.11-rc3-mm2.diff

PATCH In review Alexander Clouter 3 participants 5 messages Feb 20, 2005 – Feb 21, 2005 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (1/1) cpufreq_conservative - cpufreq_conservative-2.6.11-rc3-mm2.diff

A new cpufreq module, based on the ondemand one with my additional patches just posted. This one is more suitable for battery environments where its probably more appealing to have the cpu freq gracefully increase and decrease rather than flip between the min and max freq's.

N.B. Bruno Ducrot pointed out that the amd64's "do have unacceptable latency between min and max freq transition, due to the step-by-step requirements (200MHz IIRC)"; so AMD64 users would probably benefit from this too.

Signature · 10 lines
 ___________________________________ 
/ Man is the measure of all things. \
|                                   |
\ -- Protagoras                     /
 ----------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
drivers/cpufreq/Kconfig +20 -0
diff -N -u linux-2.6.11-rc3-mm2.orig/drivers/cpufreq/Kconfig linux-2.6.11-rc3-mm2/drivers/cpufreq/Kconfig
@@ -115,4 +115,24 @@
 
 	  If in doubt, say N.
 
+config CPU_FREQ_GOV_CONSERVATIVE
+	tristate "'conservative' cpufreq governor"
+	depends on CPU_FREQ
+	help
+	  'conservative' - this driver is rather similar to the 'ondemand'
+	  governor both in its source code and its purpose, the difference is
+	  its optimisation for better suitability in a battery powered
+	  environment.  The frequency is gracefully increased and decreased
+	  rather than jumping to 100% when speed is required.
+
+	  If you have a desktop machine then you should really be considering
+	  the 'ondemand' governor instead, however if you are using a laptop,
+	  PDA or even an AMD64 based computer (due to the unacceptable
+	  step-by-step latency issues between the minimum and maximum frequency
+	  transitions in the CPU) you will probably want to use this governor.
+
+	  For details, take a look at linux/Documentation/cpu-freq.
+
+	  If in doubt, say N.
+
 endif	# CPU_FREQ
drivers/cpufreq/Makefile +1 -0
diff -N -u linux-2.6.11-rc3-mm2.orig/drivers/cpufreq/Makefile linux-2.6.11-rc3-mm2/drivers/cpufreq/Makefile
@@ -8,6 +8,7 @@
 obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE)	+= cpufreq_powersave.o
 obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE)	+= cpufreq_userspace.o
 obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND)	+= cpufreq_ondemand.o
+obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE)	+= cpufreq_conservative.o
 
 # CPUfreq cross-arch helpers
 obj-$(CONFIG_CPU_FREQ_TABLE)		+= freq_table.o
drivers/cpufreq/cpufreq_conservative.c +615 -0

615 lines not on this page · raw message

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

#1 lore raw
Quoted 9 lines · Alexander Clouter

A new cpufreq module, based on the ondemand one with my additional patches just posted. This one is more suitable for battery environments where its probably more appealing to have the cpu freq gracefully increase and decrease rather than flip between the min and max freq's.

N.B. Bruno Ducrot pointed out that the amd64's "do have unacceptable latency between min and max freq transition, due to the step-by-step requirements (200MHz IIRC)"; so AMD64 users would probably benefit from this too.

Ah, I see now why you want to tweak percentage.

Quoted 1 line
drivers/cpufreq/cpufreq_conservative.c +1 -0
+	if (idle_ticks > down_idle_ticks ) {

...
...

drivers/cpufreq/cpufreq_conservative.c line 463

Quoted 3 lines
drivers/cpufreq/cpufreq_conservative.c +3 -0
+		__cpufreq_driver_target(policy,
+			requested_freq[cpu],
+			CPUFREQ_RELATION_H);

^^^^^^^^^^^^^^^^^^
Please use CPUFREQ_RELATION_L here, so that when going down
the governor will go to the next lower frequency (even if requested_freq[cpu] is current_freq -1 ;)

Cheers,

Signature · 4 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
#2 lore raw
Quoted 5 lines · Bruno Ducrot

drivers/cpufreq/cpufreq_conservative.c line 463

Quoted 3 lines
drivers/cpufreq/cpufreq_conservative.c +3 -0
+		__cpufreq_driver_target(policy,
+			requested_freq[cpu],
+			CPUFREQ_RELATION_H);

^^^^^^^^^^^^^^^^^^
Please use CPUFREQ_RELATION_L

_L means CPU frequency is _larger_ than (or equal to) requested_freq[cpu] but as _low_ as possible.

_H means CPU frequency is _lower_ than (or equal to) requested_freq[cpu] but as _high_ as possible.

So, AFAICS, _H is correct here.

Dominik

#3 lore raw
Quoted 7 lines · Dominik Brodowski
Quoted 5 lines · Bruno Ducrot

drivers/cpufreq/cpufreq_conservative.c line 463

Quoted 3 lines
drivers/cpufreq/cpufreq_conservative.c +3 -0
+		__cpufreq_driver_target(policy,
+			requested_freq[cpu],
+			CPUFREQ_RELATION_H);

^^^^^^^^^^^^^^^^^^
Please use CPUFREQ_RELATION_L

Quoted 7 lines

_L means CPU frequency is _larger_ than (or equal to) requested_freq[cpu] but as _low_ as possible.

_H means CPU frequency is _lower_ than (or equal to) requested_freq[cpu] but as _high_ as possible.

So, AFAICS, _H is correct here.

the code seems to look something like that (but I maybe wrong):

	if (idle_ticks < up_idle) {
		/* my own comment: go up by 5% */
		...
		__cpufreq_driver_target(policy, requested_freq[cpu],
			CPUFREQ_RELATION_H);
		...

	}
	...

	if (idle_ticks > down_idle_ticks ) {
		/* go down by 5% */
		...
		__cpufreq_driver_target(policy, requested_freq[cpu],
			 CPUFREQ_RELATION_H);
		...
	}
	...

The first __cpufreq_driver_target() is correct, but the latter should be CPUFREQ_RELATION_L, which exactly match your words:

Quoted 2 lines

_L means CPU frequency is _larger_ than (or equal to) requested_freq[cpu] but as _low_ as possible.

There were the if() statement in my previous mail to distinguish the two calls for __cpufreq_driver_target() but it was not enough clear.

Sorry for confusion.

Cheers,

Signature · 4 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
#4 lore raw
Quoted 5 lines · Bruno Ducrot
Quoted 2 lines

_L means CPU frequency is _larger_ than (or equal to) requested_freq[cpu] but as _low_ as possible.

There were the if() statement in my previous mail to distinguish the two calls for __cpufreq_driver_target() but it was not enough clear.

Yes, you're right.

Quoted 1 line

Sorry for confusion.

I should have looked more closely at the code at question... thanks for clarifying this.

Dominik