]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/powerpc/kernel/time.c
Merge branches 'pm-core', 'pm-qos', 'pm-domains' and 'pm-opp'
[linux.git] / arch / powerpc / kernel / time.c
index 739897a10fd3a72f0e0659a7fb93c894b4ad4b3a..14e485525e317907c52d0183c88d8887cc77ff97 100644 (file)
@@ -57,6 +57,7 @@
 #include <linux/clk-provider.h>
 #include <linux/suspend.h>
 #include <linux/rtc.h>
+#include <linux/cputime.h>
 #include <asm/trace.h>
 
 #include <asm/io.h>
@@ -72,7 +73,6 @@
 #include <asm/smp.h>
 #include <asm/vdso_datapage.h>
 #include <asm/firmware.h>
-#include <asm/cputime.h>
 #include <asm/asm-prototypes.h>
 
 /* powerpc clocksource/clockevent code */
@@ -152,20 +152,11 @@ EXPORT_SYMBOL_GPL(ppc_tb_freq);
 
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
 /*
- * Factors for converting from cputime_t (timebase ticks) to
- * jiffies, microseconds, seconds, and clock_t (1/USER_HZ seconds).
- * These are all stored as 0.64 fixed-point binary fractions.
+ * Factor for converting from cputime_t (timebase ticks) to
+ * microseconds. This is stored as 0.64 fixed-point binary fraction.
  */
-u64 __cputime_jiffies_factor;
-EXPORT_SYMBOL(__cputime_jiffies_factor);
 u64 __cputime_usec_factor;
 EXPORT_SYMBOL(__cputime_usec_factor);
-u64 __cputime_sec_factor;
-EXPORT_SYMBOL(__cputime_sec_factor);
-u64 __cputime_clockt_factor;
-EXPORT_SYMBOL(__cputime_clockt_factor);
-
-cputime_t cputime_one_jiffy;
 
 #ifdef CONFIG_PPC_SPLPAR
 void (*dtl_consumer)(struct dtl_entry *, u64);
@@ -181,14 +172,8 @@ static void calc_cputime_factors(void)
 {
        struct div_result res;
 
-       div128_by_32(HZ, 0, tb_ticks_per_sec, &res);
-       __cputime_jiffies_factor = res.result_low;
        div128_by_32(1000000, 0, tb_ticks_per_sec, &res);
        __cputime_usec_factor = res.result_low;
-       div128_by_32(1, 0, tb_ticks_per_sec, &res);
-       __cputime_sec_factor = res.result_low;
-       div128_by_32(USER_HZ, 0, tb_ticks_per_sec, &res);
-       __cputime_clockt_factor = res.result_low;
 }
 
 /*
@@ -399,7 +384,7 @@ void vtime_flush(struct task_struct *tsk)
                tsk->utimescaled += cputime_to_nsecs(acct->utime_scaled);
 
        if (acct->gtime)
-               account_guest_time(tsk, acct->gtime);
+               account_guest_time(tsk, cputime_to_nsecs(acct->gtime));
 
        if (acct->steal_time)
                account_steal_time(cputime_to_nsecs(acct->steal_time));
@@ -408,16 +393,17 @@ void vtime_flush(struct task_struct *tsk)
                account_idle_time(cputime_to_nsecs(acct->idle_time));
 
        if (acct->stime)
-               account_system_index_time(tsk, acct->stime, CPUTIME_SYSTEM);
-
+               account_system_index_time(tsk, cputime_to_nsecs(acct->stime),
+                                         CPUTIME_SYSTEM);
        if (acct->stime_scaled)
                tsk->stimescaled += cputime_to_nsecs(acct->stime_scaled);
 
        if (acct->hardirq_time)
-               account_system_index_time(tsk, acct->hardirq_time, CPUTIME_IRQ);
-
+               account_system_index_time(tsk, cputime_to_nsecs(acct->hardirq_time),
+                                         CPUTIME_IRQ);
        if (acct->softirq_time)
-               account_system_index_time(tsk, acct->softirq_time, CPUTIME_SOFTIRQ);
+               account_system_index_time(tsk, cputime_to_nsecs(acct->softirq_time),
+                                         CPUTIME_SOFTIRQ);
 
        acct->utime = 0;
        acct->utime_scaled = 0;
@@ -1052,7 +1038,6 @@ void __init time_init(void)
        tb_ticks_per_sec = ppc_tb_freq;
        tb_ticks_per_usec = ppc_tb_freq / 1000000;
        calc_cputime_factors();
-       setup_cputime_one_jiffy();
 
        /*
         * Compute scale factor for sched_clock.