Commit a8e0c51c authored by David Woodhouse's avatar David Woodhouse Committed by Linus Torvalds

[PATCH] powerpc: implement missing jiffies64_to_cputime64()

asm-powerpc/cputime.h doesn't declare jiffies64_to_cputime64() or
cputime64_sub(), and due to CONFIG_VIRT_CPU_ACCOUNTING it's not picking
up the definition from asm-generic like x86-64 & friends do.

Cc: Dave Jones <davej@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ba1826e5
...@@ -43,6 +43,7 @@ typedef u64 cputime64_t; ...@@ -43,6 +43,7 @@ typedef u64 cputime64_t;
#define cputime64_zero ((cputime64_t)0) #define cputime64_zero ((cputime64_t)0)
#define cputime64_add(__a, __b) ((__a) + (__b)) #define cputime64_add(__a, __b) ((__a) + (__b))
#define cputime64_sub(__a, __b) ((__a) - (__b))
#define cputime_to_cputime64(__ct) (__ct) #define cputime_to_cputime64(__ct) (__ct)
#ifdef __KERNEL__ #ifdef __KERNEL__
...@@ -74,6 +75,23 @@ static inline cputime_t jiffies_to_cputime(const unsigned long jif) ...@@ -74,6 +75,23 @@ static inline cputime_t jiffies_to_cputime(const unsigned long jif)
return ct; return ct;
} }
static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
{
cputime_t ct;
u64 sec;
/* have to be a little careful about overflow */
ct = jif % HZ;
sec = jif / HZ;
if (ct) {
ct *= tb_ticks_per_sec;
do_div(ct, HZ);
}
if (sec)
ct += (cputime_t) sec * tb_ticks_per_sec;
return ct;
}
static inline u64 cputime64_to_jiffies64(const cputime_t ct) static inline u64 cputime64_to_jiffies64(const cputime_t ct)
{ {
return mulhdu(ct, __cputime_jiffies_factor); return mulhdu(ct, __cputime_jiffies_factor);
......
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