aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2011-12-09 06:35:08 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-12-18 22:41:20 -0500
commit9f5072d4f63f28d30d343573830ac6c85fc0deff (patch)
tree60d0a8dee9620e75c6da87b3ab09813945dec336 /arch/powerpc/include
parent2011b1d0d31ae469c7a075061e03b7d4f5b49ba6 (diff)
powerpc: Fix wrong divisor in usecs_to_cputime
Commit d57af9b (taskstats: use real microsecond granularity for CPU times) renamed msecs_to_cputime to usecs_to_cputime, but failed to update all numbers on the way. This causes nonsensical cpu idle/iowait values to be displayed in /proc/stat (the only user of usecs_to_cputime so far). This also renames __cputime_msec_factor to __cputime_usec_factor, adapting its value and using it directly in cputime_to_usecs instead of doing two multiplications. Signed-off-by: Andreas Schwab <schwab@linux-m68k.org> Acked-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/cputime.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
index 1cf20bdfbeca..33a35801f7c9 100644
--- a/arch/powerpc/include/asm/cputime.h
+++ b/arch/powerpc/include/asm/cputime.h
@@ -126,11 +126,11 @@ static inline u64 cputime64_to_jiffies64(const cputime_t ct)
126/* 126/*
127 * Convert cputime <-> microseconds 127 * Convert cputime <-> microseconds
128 */ 128 */
129extern u64 __cputime_msec_factor; 129extern u64 __cputime_usec_factor;
130 130
131static inline unsigned long cputime_to_usecs(const cputime_t ct) 131static inline unsigned long cputime_to_usecs(const cputime_t ct)
132{ 132{
133 return mulhdu(ct, __cputime_msec_factor) * USEC_PER_MSEC; 133 return mulhdu(ct, __cputime_usec_factor);
134} 134}
135 135
136static inline cputime_t usecs_to_cputime(const unsigned long us) 136static inline cputime_t usecs_to_cputime(const unsigned long us)
@@ -143,7 +143,7 @@ static inline cputime_t usecs_to_cputime(const unsigned long us)
143 sec = us / 1000000; 143 sec = us / 1000000;
144 if (ct) { 144 if (ct) {
145 ct *= tb_ticks_per_sec; 145 ct *= tb_ticks_per_sec;
146 do_div(ct, 1000); 146 do_div(ct, 1000000);
147 } 147 }
148 if (sec) 148 if (sec)
149 ct += (cputime_t) sec * tb_ticks_per_sec; 149 ct += (cputime_t) sec * tb_ticks_per_sec;