diff options
author | Chris Redpath <chris.redpath@arm.com> | 2013-06-17 18:36:56 +0100 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2013-07-17 17:21:54 +0100 |
commit | 1d7f81197e575c00bf5dfa988f4c7a12c45993b2 (patch) | |
tree | d11bf99bf12a08eb144963a4c2d7cb0fd7bdac17 | |
parent | cbb39a8dbf53df05b7d9e98e6c0f6f375ed811b5 (diff) |
cpufreq: interactive governor drops bits in time calculationlsk-interactive-gov-updates
Keep time calculation in 64-bit throughout. If we have long times
between idle calculations this can result in deltas > 32 bits
which causes incorrect load percentage calculations and selecting
the wrong frequencies if we truncate here.
Signed-off-by: Chris Redpath <chris.redpath@arm.com>
-rw-r--r-- | drivers/cpufreq/cpufreq_interactive.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 7f1782ade53..a494fbd7dbe 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -316,13 +316,13 @@ static u64 update_load(int cpu) pcpu->policy->governor_data; u64 now; u64 now_idle; - unsigned int delta_idle; - unsigned int delta_time; + u64 delta_idle; + u64 delta_time; u64 active_time; now_idle = get_cpu_idle_time(cpu, &now, tunables->io_is_busy); - delta_idle = (unsigned int)(now_idle - pcpu->time_in_idle); - delta_time = (unsigned int)(now - pcpu->time_in_idle_timestamp); + delta_idle = (now_idle - pcpu->time_in_idle); + delta_time = (now - pcpu->time_in_idle_timestamp); if (delta_time <= delta_idle) active_time = 0; |