Commit f7dcd63d authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar

x86: Convert obsolete cputime type to nsecs

Use the new nsec based cputime accessors as part of the whole cputime
conversion from cputime_t to nsecs.
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1485832191-26889-10-git-send-email-fweisbec@gmail.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent dc9b77b5
...@@ -905,21 +905,21 @@ static int apm_cpu_idle(struct cpuidle_device *dev, ...@@ -905,21 +905,21 @@ static int apm_cpu_idle(struct cpuidle_device *dev,
{ {
static int use_apm_idle; /* = 0 */ static int use_apm_idle; /* = 0 */
static unsigned int last_jiffies; /* = 0 */ static unsigned int last_jiffies; /* = 0 */
static unsigned int last_stime; /* = 0 */ static u64 last_stime; /* = 0 */
cputime_t stime, utime; u64 stime, utime;
int apm_idle_done = 0; int apm_idle_done = 0;
unsigned int jiffies_since_last_check = jiffies - last_jiffies; unsigned int jiffies_since_last_check = jiffies - last_jiffies;
unsigned int bucket; unsigned int bucket;
recalc: recalc:
task_cputime_t(current, &utime, &stime); task_cputime(current, &utime, &stime);
if (jiffies_since_last_check > IDLE_CALC_LIMIT) { if (jiffies_since_last_check > IDLE_CALC_LIMIT) {
use_apm_idle = 0; use_apm_idle = 0;
} else if (jiffies_since_last_check > idle_period) { } else if (jiffies_since_last_check > idle_period) {
unsigned int idle_percentage; unsigned int idle_percentage;
idle_percentage = cputime_to_jiffies(stime - last_stime); idle_percentage = nsecs_to_jiffies(stime - last_stime);
idle_percentage *= 100; idle_percentage *= 100;
idle_percentage /= jiffies_since_last_check; idle_percentage /= jiffies_since_last_check;
use_apm_idle = (idle_percentage > idle_threshold); use_apm_idle = (idle_percentage > idle_threshold);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment