Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

David Woodhouse and committed by
Linus Torvalds
a8e0c51c ba1826e5

+18
+18
include/asm-powerpc/cputime.h
··· 43 43 44 44 #define cputime64_zero ((cputime64_t)0) 45 45 #define cputime64_add(__a, __b) ((__a) + (__b)) 46 + #define cputime64_sub(__a, __b) ((__a) - (__b)) 46 47 #define cputime_to_cputime64(__ct) (__ct) 47 48 48 49 #ifdef __KERNEL__ ··· 62 61 { 63 62 cputime_t ct; 64 63 unsigned long sec; 64 + 65 + /* have to be a little careful about overflow */ 66 + ct = jif % HZ; 67 + sec = jif / HZ; 68 + if (ct) { 69 + ct *= tb_ticks_per_sec; 70 + do_div(ct, HZ); 71 + } 72 + if (sec) 73 + ct += (cputime_t) sec * tb_ticks_per_sec; 74 + return ct; 75 + } 76 + 77 + static inline cputime64_t jiffies64_to_cputime64(const u64 jif) 78 + { 79 + cputime_t ct; 80 + u64 sec; 65 81 66 82 /* have to be a little careful about overflow */ 67 83 ct = jif % HZ;