mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
cpufreq: interactive governor drops bits in time calculation
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.
Change-Id: Ia9e0b8f14a1472001a922f7accb53e6a0da4d0a0
Signed-off-by: Chris Redpath <chris.redpath@arm.com>
(cherry picked from commit 6696986a93)
Signed-off-by: Quentin Perret <quentin.perret@arm.com>
This commit is contained in:
@@ -337,12 +337,11 @@ static unsigned int choose_freq(struct interactive_cpu *icpu,
|
||||
static u64 update_load(struct interactive_cpu *icpu, int cpu)
|
||||
{
|
||||
struct interactive_tunables *tunables = icpu->ipolicy->tunables;
|
||||
unsigned int delta_idle, delta_time;
|
||||
u64 now_idle, now, active_time;
|
||||
u64 now_idle, now, active_time, delta_idle, delta_time;
|
||||
|
||||
now_idle = get_cpu_idle_time(cpu, &now, tunables->io_is_busy);
|
||||
delta_idle = (unsigned int)(now_idle - icpu->time_in_idle);
|
||||
delta_time = (unsigned int)(now - icpu->time_in_idle_timestamp);
|
||||
delta_idle = (now_idle - icpu->time_in_idle);
|
||||
delta_time = (now - icpu->time_in_idle_timestamp);
|
||||
|
||||
if (delta_time <= delta_idle)
|
||||
active_time = 0;
|
||||
|
||||
Reference in New Issue
Block a user