summaryrefslogtreecommitdiff
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorXinyu Chen <xinyu.chen@freescale.com>2012-04-20 11:28:57 +0800
committerXinyu Chen <xinyu.chen@freescale.com>2012-04-20 11:28:57 +0800
commiteb1da050c08bb961a1e45dd51f97821d3eeb2ae9 (patch)
tree543a339d5395485a5a2d99f91e42c817a147b461 /drivers/cpufreq
parent8e3395a73276d41082c35e2af21d44dbd3d648ff (diff)
parent2914e50b00af66d52eac98fa58e4f4f159a2305b (diff)
Merge branch 'android-3.0' into imx_3.0.15_android
Conflicts: drivers/cpufreq/cpufreq_interactive.c
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq_interactive.c58
1 files changed, 37 insertions, 21 deletions
diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c
index 68232e39f6bc..123c86409ec1 100644
--- a/drivers/cpufreq/cpufreq_interactive.c
+++ b/drivers/cpufreq/cpufreq_interactive.c
@@ -30,6 +30,9 @@
#include <linux/mutex.h>
#include <linux/kernel_stat.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/cpufreq_interactive.h>
+
#include <asm/cputime.h>
static atomic_t active_count = ATOMIC_INIT(0);
@@ -41,8 +44,8 @@ struct cpufreq_interactive_cpuinfo {
u64 idle_exit_time;
u64 timer_run_time;
int idling;
- u64 freq_change_time;
- u64 freq_change_time_in_idle;
+ u64 target_set_time;
+ u64 target_set_time_in_idle;
struct cpufreq_policy *policy;
struct cpufreq_frequency_table *freq_table;
unsigned int target_freq;
@@ -189,9 +192,9 @@ static void cpufreq_interactive_timer(unsigned long data)
cpu_load = 100 * (delta_time - delta_idle) / delta_time;
delta_idle = (unsigned int) cputime64_sub(now_idle,
- pcpu->freq_change_time_in_idle);
+ pcpu->target_set_time_in_idle);
delta_time = (unsigned int) cputime64_sub(pcpu->timer_run_time,
- pcpu->freq_change_time);
+ pcpu->target_set_time);
if ((delta_time == 0) || (delta_idle > delta_time))
load_since_change = 0;
@@ -209,14 +212,18 @@ static void cpufreq_interactive_timer(unsigned long data)
irq_load = cpufreq_interactive_check_irq();
if (cpu_load >= go_hispeed_load || irq_load) {
- if (pcpu->policy->cur == pcpu->policy->min)
+ if (pcpu->policy->cur == pcpu->policy->min) {
new_freq = hispeed_freq;
- else
+ } else {
new_freq = pcpu->policy->max * cpu_load / 100;
+
+ if (new_freq < hispeed_freq)
+ new_freq = hispeed_freq;
+ }
if (irq_load)
new_freq = hispeed_freq;
} else {
- new_freq = pcpu->policy->cur * cpu_load / 100;
+ new_freq = pcpu->policy->max * cpu_load / 100;
}
if (cpufreq_frequency_table_target(pcpu->policy, pcpu->freq_table,
@@ -229,19 +236,31 @@ static void cpufreq_interactive_timer(unsigned long data)
new_freq = pcpu->freq_table[index].frequency;
- if (pcpu->target_freq == new_freq)
- goto rearm_if_notmax;
-
/*
* Do not scale down unless we have been at this frequency for the
* minimum sample time.
*/
if (new_freq < pcpu->target_freq) {
- if (cputime64_sub(pcpu->timer_run_time, pcpu->freq_change_time)
- < min_sample_time)
+ if (cputime64_sub(pcpu->timer_run_time, pcpu->target_set_time)
+ < min_sample_time) {
+ trace_cpufreq_interactive_notyet(data, cpu_load,
+ pcpu->target_freq, new_freq);
goto rearm;
+ }
}
+ pcpu->target_set_time_in_idle = now_idle;
+ pcpu->target_set_time = pcpu->timer_run_time;
+
+ if (pcpu->target_freq == new_freq) {
+ trace_cpufreq_interactive_already(data, cpu_load,
+ pcpu->target_freq, new_freq);
+ goto rearm_if_notmax;
+ }
+
+ trace_cpufreq_interactive_target(data, cpu_load, pcpu->target_freq,
+ new_freq);
+
if (new_freq < pcpu->target_freq) {
pcpu->target_freq = new_freq;
spin_lock_irqsave(&down_cpumask_lock, flags);
@@ -423,10 +442,8 @@ static int cpufreq_interactive_up_task(void *data)
max_freq,
CPUFREQ_RELATION_H);
mutex_unlock(&set_speed_lock);
-
- pcpu->freq_change_time_in_idle =
- get_cpu_idle_time_us(cpu,
- &pcpu->freq_change_time);
+ trace_cpufreq_interactive_up(cpu, pcpu->target_freq,
+ pcpu->policy->cur);
}
}
@@ -468,9 +485,8 @@ static void cpufreq_interactive_freq_down(struct work_struct *work)
CPUFREQ_RELATION_H);
mutex_unlock(&set_speed_lock);
- pcpu->freq_change_time_in_idle =
- get_cpu_idle_time_us(cpu,
- &pcpu->freq_change_time);
+ trace_cpufreq_interactive_down(cpu, pcpu->target_freq,
+ pcpu->policy->cur);
}
}
@@ -642,9 +658,9 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
pcpu->policy = policy;
pcpu->target_freq = policy->cur;
pcpu->freq_table = freq_table;
- pcpu->freq_change_time_in_idle =
+ pcpu->target_set_time_in_idle =
get_cpu_idle_time_us(j,
- &pcpu->freq_change_time);
+ &pcpu->target_set_time);
pcpu->governor_enabled = 1;
smp_wmb();
}