aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-24 04:08:47 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-24 04:08:47 -0500
commita0e5af3cb89b59aa6c62b1f97c8d553ff3fb51c1 (patch)
tree59e31166d9a0317009dc47383edd92e9e1012cca
parentd3c31a773fa33f78a29bb00ed0dcf8fa55dd4b3a (diff)
cpufreq: governors: Fix jiffies/cputime mixup (revisited)
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>
-rw-r--r--drivers/cpufreq/cpufreq_governor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index be9d255e292f..6c5f1d383cdc 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -45,9 +45,9 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
45 45
46 idle_time = cur_wall_time - busy_time; 46 idle_time = cur_wall_time - busy_time;
47 if (wall) 47 if (wall)
48 *wall = jiffies_to_usecs(cur_wall_time); 48 *wall = cputime_to_usecs(cur_wall_time);
49 49
50 return jiffies_to_usecs(idle_time); 50 return cputime_to_usecs(idle_time);
51} 51}
52 52
53u64 get_cpu_idle_time(unsigned int cpu, u64 *wall) 53u64 get_cpu_idle_time(unsigned int cpu, u64 *wall)