]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cpufreq: governors: Fix jiffies/cputime mixup (revisited)
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 24 Nov 2012 09:08:47 +0000 (10:08 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 24 Nov 2012 09:08:47 +0000 (10:08 +0100)
This change was made by commit 8636fd2 (cpufreq: fix jiffies/cputime
mixup in conservative/ondemand governors) before, but then it has
been reverted inadvertently by commit 4471a34 (cpufreq: governors:
remove redundant code).

The changelog of commit 8636fd2's says:

  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.

Since now we have only one common get_cpu_idle_time_jiffy() used by
both governors in question, modify it along the lines of commit
8636fd2 to restore the correct behavior.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/cpufreq_governor.c

index be9d255e292f7619c5eff48168ba5b8f138c811b..6c5f1d383cdce86b783fc37077798a8a980c4116 100644 (file)
@@ -45,9 +45,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);
 }
 
 u64 get_cpu_idle_time(unsigned int cpu, u64 *wall)