Skip to contentSkip to conversation

Add on-demand cpu-freq governor as default option

PATCH In review Con Kolivas 2 participants 4 messages Sep 20, 2004 – Sep 21, 2004 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add on-demand cpu-freq governor as default option

This patch adds the option of using the on-demand cpu-frequency governor as the default governor in Kconfig.

drivers/cpufreq/Kconfig +11 -0
Index: linux-2.6.9-rc2-mm1/drivers/cpufreq/Kconfig
===================================================================
@@ -36,6 +36,17 @@ config CPU_FREQ_DEFAULT_GOV_USERSPACE
 	  program shall be able to set the CPU dynamically without having
 	  to enable the userspace governor manually.
 
+config CPU_FREQ_DEFAULT_GOV_ONDEMAND
+	bool "ondemand"
+	select CPU_FREQ_GOV_ONDEMAND
+	help
+	  Use the CPUFreq governor 'ondemand' as default. 
+	  This governor does a periodic polling and 
+	  changes frequency based on the CPU utilization.
+	  The support for this governor depends on CPU capability to
+	  do fast frequency switching (i.e, very low latency frequency
+	  transitions). 
+
 endchoice
 
 config CPU_FREQ_GOV_PERFORMANCE
include/linux/cpufreq.h +3 -0
Index: linux-2.6.9-rc2-mm1/include/linux/cpufreq.h
===================================================================
@@ -323,6 +323,9 @@ extern struct cpufreq_governor cpufreq_g
 #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)
 extern struct cpufreq_governor cpufreq_gov_userspace;
 #define CPUFREQ_DEFAULT_GOVERNOR	&cpufreq_gov_userspace
+#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND)
+extern struct cpufreq_governor cpufreq_gov_dbs;
+#define CPUFREQ_DEFAULT_GOVERNOR	&cpufreq_gov_dbs
 #endif
 
 
#1 lore raw

I'm sorry, but this can't be done at the moment. The default cpufreq governor needs to be one which can't fail to start up. And on-demand has quite strict requirements on when it allows to be started and when it doesn't.

Dominik

#2 lore raw
Quoted 4 lines · Dominik Brodowski

I'm sorry, but this can't be done at the moment. The default cpufreq governor needs to be one which can't fail to start up. And on-demand has quite strict requirements on when it allows to be started and when it doesn't.

Ah ok. Thanks.

2 little questions please?

1. Would it be inappropriate to make it drop back to a different governor so that it can be selected?
2. Can cpu throttling be incorporated into this governor as well as a secondary mechanism for the lowest cpu frequency and as a primary mechanism for those cpus that don't support cpufreq?

Cheers,
Con

#3 lore raw

Hi,

Quoted 2 lines · Con Kolivas

1. Would it be inappropriate to make it drop back to a different governor so that it can be selected?

This would involve major changes to the cpufreq core, and it wouldn't make it easier. I'll add it to my TODO list and think about it again once more important issues are adressed. Agreed?

Quoted 3 lines

2. Can cpu throttling be incorporated into this governor as well as a secondary mechanism for the lowest cpu frequency and as a primary mechanism for those cpus that don't support cpufreq?

a) it hasn't to do anything with the _governor_. The governor works with whatever method is offered to him, may it be frequency scaling or throttling. Actually, some CPUfreq drivers actually only do throttling, and you can use ondemand for them [if their latency values are set correctly, that is].

b) on-demand throttling is useless. Throttling sets the CPU to the same internal power state as the ACPI idle state C2 does [and C2 has quite the same energy consumption as C1, actually...], so lowering the time spent idling and increasing throttling doesn't save energy, while lowering idling and increasing frequency scaling does save much energy.

c) As throttling does make sense for thermal management and certain energy consumption requirements [e.g. the battery isn't strong enough for the CPU running at 100%], adapting the CPUfreq core to support loading one frequency scaling and one frequency throttling driver at the same time is something I have in my TODO list as well. Nonetheless, it will not be made available for "on-demand" throttling, unless I'm convinced otherwise.

Thanks,
Dominik