cpufreq: Governor poll frequency tuneables exported in config.
PATCH 1/1 cpufreq: Governor poll frequency tuneables exported in config.
cpufreq: Governor poll frequency tuneables exported in config.
drivers/cpufreq/Kconfig +13 -0
@@ -190,4 +190,17 @@ config CPU_FREQ_GOV_CONSERVATIVE If in doubt, say N. +config CPU_FREQ_MIN_TICKS + int "Ticks between governor polling interval." + default 10 + help + Minimum number of ticks between polling interval for governors. + +config CPU_FREQ_SAMPLING_LATENCY_MULTIPLIER + int "Sampling rate multiplier for governors." + default 1000 + help + Sampling latency rate multiplied by the cpu switch latency. + Affects governor polling. + endif # CPU_FREQ
drivers/cpufreq/cpufreq_conservative.c +2 -3
@@ -51,11 +51,10 @@ static unsigned int def_sampling_rate;#define MIN_SAMPLING_RATE_RATIO (2)/* for correct statistics, we need at least 10 ticks between each measure */ #define MIN_STAT_SAMPLING_RATE \ - (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) + (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(CONFIG_CPU_FREQ_MIN_TICKS))#define MIN_SAMPLING_RATE \ (def_sampling_rate / MIN_SAMPLING_RATE_RATIO)#define MAX_SAMPLING_RATE (500 * def_sampling_rate) -#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000)#define DEF_SAMPLING_DOWN_FACTOR (1)#define MAX_SAMPLING_DOWN_FACTOR (10)#define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000)
@@ -523,7 +522,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, latency =1 ; def_sampling_rate =10 * latency * -DEF_SAMPLING_RATE_LATENCY_MULTIPLIER ; +CONFIG_CPU_FREQ_SAMPLING_LATENCY_MULTIPLIER ;if (def_sampling_rate <MIN_STAT_SAMPLING_RATE ) def_sampling_rate =MIN_STAT_SAMPLING_RATE ;
drivers/cpufreq/cpufreq_ondemand.c +2 -3
@@ -42,11 +42,10 @@ static unsigned int def_sampling_rate;#define MIN_SAMPLING_RATE_RATIO (2)/* for correct statistics, we need at least 10 ticks between each measure */ #define MIN_STAT_SAMPLING_RATE \ - (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) + (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(CONFIG_CPU_FREQ_MIN_TICKS))#define MIN_SAMPLING_RATE \ (def_sampling_rate / MIN_SAMPLING_RATE_RATIO)#define MAX_SAMPLING_RATE (500 * def_sampling_rate) -#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000)#define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000)static void do_dbs_timer (struct work_struct *work);
@@ -542,7 +541,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, latency =1 ; def_sampling_rate = latency * -DEF_SAMPLING_RATE_LATENCY_MULTIPLIER ; +CONFIG_CPU_FREQ_SAMPLING_LATENCY_MULTIPLIER ;if (def_sampling_rate <MIN_STAT_SAMPLING_RATE ) def_sampling_rate =MIN_STAT_SAMPLING_RATE ;
Mike Chan schreef:
Quoted 2 lines
cpufreq: Governor poll frequency tuneables exported in config.
Hello,
drivers/cpufreq/Kconfig config CPU_FREQ_GOV_CONSERVATIVE · line 197
Quoted 5 lines
drivers/cpufreq/Kconfig +5
-0+config CPU_FREQ_MIN_TICKS + int "Ticks between governor polling interval." + default 10 + help + Minimum number of ticks between polling interval for governors.
I don't think it makes much sense to let anyone tune this parameter. This is a constant that says we need at least a 10% granularity to compute any statistic correctly. There is nothing much to be discussed or tuned.
drivers/cpufreq/Kconfig config CPU_FREQ_GOV_CONSERVATIVE · line 204
Quoted 6 lines
drivers/cpufreq/Kconfig +6
-0+config CPU_FREQ_SAMPLING_LATENCY_MULTIPLIER + int "Sampling rate multiplier for governors." + default 1000 + help + Sampling latency rate multiplied by the cpu switch latency. + Affects governor polling.
This one, why not (although I don't think it's worth neither), and it would need a better documentation.
Eric
Quoted 16 lines · On Monday 16 February 2009 14:33:54 Éric Piel wrote:
Mike Chan schreef:
Quoted 2 lines
cpufreq: Governor poll frequency tuneables exported in config.
Hello,
drivers/cpufreq/Kconfig config CPU_FREQ_GOV_CONSERVATIVE · line 197
Quoted 5 lines
drivers/cpufreq/Kconfig +5
-0+config CPU_FREQ_MIN_TICKS + int "Ticks between governor polling interval." + default 10 + help + Minimum number of ticks between polling interval for governors.I don't think it makes much sense to let anyone tune this parameter. This is a constant that says we need at least a 10% granularity to compute any statistic correctly. There is nothing much to be discussed or tuned.
Quoted 8 lines
drivers/cpufreq/Kconfig config CPU_FREQ_GOV_CONSERVATIVE · line 204
Quoted 6 lines
drivers/cpufreq/Kconfig +6
-0+config CPU_FREQ_SAMPLING_LATENCY_MULTIPLIER + int "Sampling rate multiplier for governors." + default 1000 + help + Sampling latency rate multiplied by the cpu switch latency. + Affects governor polling.This one, why not (although I don't think it's worth neither), and it would need a better documentation.
It is already configurable in userspace, no need to introduce a new config variable:
Documentation/cpu-freq/governors.txt
==================sampling_rate: measured in uS (10^-6 seconds), this is how often you want the kernel to look at the CPU usage and to make decisions on what to do about the frequency. Typically this is set to values of around '10000' or more. It's default value is (cmp. with users-guide.txt):transition_latency * 1000
The lowest value you can set is:transition_latency * 100 or it may get restricted to a value where it makes not sense for the kernel anymore to poll that often which depends on your HZ config variable (HZ=1000: max=20000us, HZ=250: max=5000). Be aware that transition latency is in ns and sampling_rate is in us, so you
get the same sysfs value by default.
Sampling rate should always get adjusted considering the transition latency To set the sampling rate 750 times as high as the transition latency in the bash (as said, 1000 is default), do:
echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) \
Quoted 1 line
ondemand/sampling_rate
===================
But this is only in the very latest cpufreq next tree and should pop up in 2.6.30.
Hmm, the statement:
"Typically this is set to values of around '10000' or more"
Is wrong (E.g. if you have HZ=250 you cannot go below 80000), but I plan to touch this again soon. Then this statement hopefully is correct again.
Thomas
Quoted 53 lines · Thomas Renninger
Quoted 16 lines · On Monday 16 February 2009 14:33:54 Éric Piel wrote:
Mike Chan schreef:
Quoted 2 lines
cpufreq: Governor poll frequency tuneables exported in config.
Hello,
drivers/cpufreq/Kconfig config CPU_FREQ_GOV_CONSERVATIVE · line 197
Quoted 5 lines
drivers/cpufreq/Kconfig +5
-0+config CPU_FREQ_MIN_TICKS + int "Ticks between governor polling interval." + default 10 + help + Minimum number of ticks between polling interval for governors.I don't think it makes much sense to let anyone tune this parameter. This is a constant that says we need at least a 10% granularity to compute any statistic correctly. There is nothing much to be discussed or tuned.
Quoted 8 lines
drivers/cpufreq/Kconfig config CPU_FREQ_GOV_CONSERVATIVE · line 204
Quoted 6 lines
drivers/cpufreq/Kconfig +6
-0+config CPU_FREQ_SAMPLING_LATENCY_MULTIPLIER + int "Sampling rate multiplier for governors." + default 1000 + help + Sampling latency rate multiplied by the cpu switch latency. + Affects governor polling.This one, why not (although I don't think it's worth neither), and it would need a better documentation.
It is already configurable in userspace, no need to introduce a new config variable:
Documentation/cpu-freq/governors.txt==================
sampling_rate: measured in uS (10^-6 seconds), this is how often you want the kernel to look at the CPU usage and to make decisions on what to do about the frequency. Typically this is set to values of around '10000' or more. It's default value is (cmp. with users-guide.txt):transition_latency* 1000
The lowest value you can set is:transition_latency* 100 or it may get restricted to a value where it makes not sense for the kernel anymore to poll that often which depends on your HZ config variable (HZ=1000: max=20000us, HZ=250: max=5000). Be aware that transition latency is in ns andsampling_rateis in us, so you
get the same sysfs value by default.
Sampling rate should always get adjusted considering the transition latency To set the sampling rate 750 times as high as the transition latency in the bash (as said, 1000 is default), do:
echo `$(($(catcpuinfo_transition_latency) * 750 / 1000)) \Quoted 1 line
ondemand/sampling_rate
===================
But this is only in the very latest cpufreq next tree and should pop up in 2.6.30.
Quoted 7 lines
Hmm, the statement:
"Typically this is set to values of around '10000' or more"
Is wrong (E.g. if you have HZ=250 you cannot go below 80000), but I plan to touch this again soon. Then this statement hopefully is correct again.Thomas
The problem currently in 29 is that I need a faster response time from the governors.
Take for example cpuinfo_transition_latency = 20us.
This gives a default sample_rate = 200ms, sample_rate_min = 100ms.
There is no way to get faster response times unless you tune those values, or lie to the governor about the cpu switch speeds.
Some will argue 100ms is sufficient, but if you are trying to render @ 60fps and are cpu bound this will cause a few dropped frames.
You mention "transition_latency * 100" but this is hard-coded in the .c file, I don't see a way around this in 29, I'm assuming this will be adjustable in 30?
I don't care so much about this patch's implementation, just that the sampling_rate limitations are not an issue in the latest cpufreq tree / 30.
Signature · 1 line
MIke Chan