powerpc32: provide VIRT_CPU_ACCOUNTING
[cascardo/linux.git] / arch / powerpc / include / asm / cputime.h
index e245255..2dfd4fc 100644 (file)
@@ -90,11 +90,10 @@ static inline void setup_cputime_one_jiffy(void)
 static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
 {
        u64 ct;
-       u64 sec;
+       u64 sec = jif;
 
        /* have to be a little careful about overflow */
-       ct = jif % HZ;
-       sec = jif / HZ;
+       ct = do_div(sec, HZ);
        if (ct) {
                ct *= tb_ticks_per_sec;
                do_div(ct, HZ);
@@ -230,7 +229,16 @@ static inline cputime_t clock_t_to_cputime(const unsigned long clk)
 
 #define cputime64_to_clock_t(ct)       cputime_to_clock_t((cputime_t)(ct))
 
+/*
+ * PPC64 uses PACA which is task independent for storing accounting data while
+ * PPC32 uses struct thread_info, therefore at task switch the accounting data
+ * has to be populated in the new task
+ */
+#ifdef CONFIG_PPC64
 static inline void arch_vtime_task_switch(struct task_struct *tsk) { }
+#else
+void arch_vtime_task_switch(struct task_struct *tsk);
+#endif
 
 #endif /* __KERNEL__ */
 #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */