Skip to content

Commit

Permalink
cpufreq: fix jiffies/cputime mixup in conservative/ondemand governors
Browse files Browse the repository at this point in the history
The function get_cpu_idle_time_jiffy in both the conservative and
ondemand governors use jiffies_to_usecs to convert a cputime value to
usecs which gives the wrong value on architectures where cputime and
jiffies use different units.  Only matters if NO_HZ is disabled, since
otherwise get_cpu_idle_time_us should already return a valid value, and
get_cpu_idle_time_jiffy isn't actually called.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Andreas Schwab authored and Rafael J. Wysocki committed Nov 14, 2012
1 parent db70115 commit 8636fd2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/cpufreq/cpufreq_governor.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)

idle_time = cur_wall_time - busy_time;
if (wall)
*wall = jiffies_to_usecs(cur_wall_time);
*wall = cputime_to_usecs(cur_wall_time);

return jiffies_to_usecs(idle_time);
return cputime_to_usecs(idle_time);
}

cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
Expand Down

0 comments on commit 8636fd2

Please sign in to comment.