Add ignore step freqency for smartass
Add more information to the returns from sysfs interface

file:1bf113db3b97a307fc7fece5b096f5a5f9a0b613 -> file:ee65bf6b0a91a403daa3c6f0fd0f0c62c64697f7
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -186,6 +186,14 @@ config SMARTASS_DEFAULT_MAX_RAMP_DOWN
help
Max freqeuncy delta when ramping down. zero disables.
+config SMARTASS_DEFAULT_IGNORE_STEP_FREQ
+ int "Ignore stepping freq"
+ default 245000
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ Ignore up and down steps at or below this frequency.
+ Default is 245000
+
config SMARTASS_DEFAULT_MAX_CPU_LOAD
int "Default max cpu load"
default 80
file:12d1d5db7e3ce39d2ec69e4da722ddded1b7a472 -> file:6baaadcf913fab3452ab4da9f957a09668aa2c24
--- a/drivers/cpufreq/cpufreq_smartass.c
+++ b/drivers/cpufreq/cpufreq_smartass.c
@@ -108,6 +108,12 @@ static unsigned int ramp_up_step;
static unsigned int max_ramp_down;
/*
+ * Ignore up and down steps at or below this frequency.
+ */
+#define DEFAULT_IGNORE_STEP_FREQ CONFIG_SMARTASS_DEFAULT_IGNORE_STEP_FREQ
+static unsigned int ignore_step_freq;
+
+/*
* CPU freq will be increased if measured load > max_cpu_load;
*/
#define DEFAULT_MAX_CPU_LOAD CONFIG_SMARTASS_DEFAULT_MAX_CPU_LOAD
@@ -226,16 +232,20 @@ static unsigned int cpufreq_smartass_cal
delta_time = (unsigned int)( current_wall_time - freq_change_time );
cpu_load = 100 * (delta_time - idle_time) / delta_time;
- //printk(KERN_INFO "Smartass calc_freq: delta_time=%u cpu_load=%u\n",delta_time,cpu_load);
+// printk(KERN_INFO "Smartass calc_freq: delta_time=%u cpu_load=%u\n",delta_time,cpu_load);
if (cpu_load < min_cpu_load) {
cpu_load += 100 - max_cpu_load; // dummy load.
new_freq = policy->cur * cpu_load / 100;
- if (max_ramp_down && new_freq < policy->cur - max_ramp_down)
- new_freq = policy->cur - max_ramp_down;
- //printk(KERN_INFO "Smartass calc_freq: %u => %u\n",policy->cur,new_freq);
+ if (new_freq > ignore_step_freq) {
+// printk(KERN_INFO "Smartass new freq: %u > %u\n", new_freq, ignore_step_freq);
+ if (max_ramp_down && new_freq < policy->cur - max_ramp_down) {
+ new_freq = policy->cur - max_ramp_down;
+ }
+ }
+// printk(KERN_INFO "Smartass calc_freq: %u => %u\n",policy->cur,new_freq);
return new_freq;
} if (cpu_load > max_cpu_load) {
- if (ramp_up_step)
+ if (ramp_up_step && new_freq > ignore_step_freq)
new_freq = policy->cur + ramp_up_step;
else
new_freq = policy->max;
@@ -310,7 +320,7 @@ static void cpufreq_smartass_freq_change
static ssize_t show_down_rate_us(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%lu\n", down_rate_us);
+ return sprintf(buf, "down_rate_us = %lu\n", down_rate_us);
}
static ssize_t store_down_rate_us(struct cpufreq_policy *policy, const char *buf, size_t count)
@@ -331,7 +341,7 @@ static struct freq_attr down_rate_us_att
static ssize_t show_up_min_freq(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%u\n", up_min_freq);
+ return sprintf(buf, "up_min_freq = %u\n", up_min_freq);
}
static ssize_t store_up_min_freq(struct cpufreq_policy *policy, const char *buf, size_t count)
@@ -352,7 +362,7 @@ static struct freq_attr up_min_freq_attr
static ssize_t show_sleep_max_freq(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%u\n", sleep_max_freq);
+ return sprintf(buf, "sleep_max_freq = %u\n", sleep_max_freq);
}
static ssize_t store_sleep_max_freq(struct cpufreq_policy *policy, const char *buf, size_t count)
@@ -373,7 +383,7 @@ static struct freq_attr sleep_max_freq_a
static ssize_t show_sleep_wakeup_freq(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%u\n", sleep_wakeup_freq);
+ return sprintf(buf, "sleep_wakeup_freq = %u\n", sleep_wakeup_freq);
}
static ssize_t store_sleep_wakeup_freq(struct cpufreq_policy *policy, const char *buf, size_t count)
@@ -394,7 +404,7 @@ static struct freq_attr sleep_wakeup_fre
static ssize_t show_sample_rate_jiffies(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%u\n", sample_rate_jiffies);
+ return sprintf(buf, "sample_rate_jiffies = %u\n", sample_rate_jiffies);
}
static ssize_t store_sample_rate_jiffies(struct cpufreq_policy *policy, const char *buf, size_t count)
@@ -415,7 +425,7 @@ static struct freq_attr sample_rate_jiff
static ssize_t show_ramp_up_step(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%u\n", ramp_up_step);
+ return sprintf(buf, "ramp_up_step = %u\n", ramp_up_step);
}
static ssize_t store_ramp_up_step(struct cpufreq_policy *policy, const char *buf, size_t count)
@@ -436,7 +446,7 @@ static struct freq_attr ramp_up_step_att
static ssize_t show_max_ramp_down(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%u\n", max_ramp_down);
+ return sprintf(buf, "max_ramp_down = %u\n", max_ramp_down);
}
static ssize_t store_max_ramp_down(struct cpufreq_policy *policy, const char *buf, size_t count)
@@ -457,7 +467,7 @@ static struct freq_attr max_ramp_down_at
static ssize_t show_max_cpu_load(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%lu\n", max_cpu_load);
+ return sprintf(buf, "max_cpu_load = %lu\n", max_cpu_load);
}
static ssize_t store_max_cpu_load(struct cpufreq_policy *policy, const char *buf, size_t count)
@@ -478,7 +488,7 @@ static struct freq_attr max_cpu_load_att
static ssize_t show_min_cpu_load(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%lu\n", min_cpu_load);
+ return sprintf(buf, "min_cpu_load = %lu\n", min_cpu_load);
}
static ssize_t store_min_cpu_load(struct cpufreq_policy *policy, const char *buf, size_t count)
@@ -629,6 +639,7 @@ static int __init cpufreq_smartass_init(
max_ramp_down = DEFAULT_MAX_RAMP_DOWN;
max_cpu_load = DEFAULT_MAX_CPU_LOAD;
min_cpu_load = DEFAULT_MIN_CPU_LOAD;
+ ignore_step_freq = DEFAULT_IGNORE_STEP_FREQ;
suspended = 0;