[PATCH] idle cputime accounting
[cascardo/linux.git] / arch / s390 / kernel / vtime.c
index 75a6e62..4a4a34c 100644 (file)
@@ -50,18 +50,24 @@ void account_process_tick(struct task_struct *tsk, int user_tick)
        rcu_user_flag = cputime != 0;
        S390_lowcore.user_timer -= cputime << 12;
        S390_lowcore.steal_clock -= cputime << 12;
-       account_user_time(tsk, cputime);
+       account_user_time(tsk, cputime, cputime);
 
        cputime =  S390_lowcore.system_timer >> 12;
        S390_lowcore.system_timer -= cputime << 12;
        S390_lowcore.steal_clock -= cputime << 12;
-       account_system_time(tsk, HARDIRQ_OFFSET, cputime);
+       if (idle_task(smp_processor_id()) != current)
+               account_system_time(tsk, HARDIRQ_OFFSET, cputime, cputime);
+       else
+               account_idle_time(cputime);
 
        cputime = S390_lowcore.steal_clock;
        if ((__s64) cputime > 0) {
                cputime >>= 12;
                S390_lowcore.steal_clock -= cputime << 12;
-               account_steal_time(tsk, cputime);
+               if (idle_task(smp_processor_id()) != current)
+                       account_steal_time(cputime);
+               else
+                       account_idle_time(cputime);
        }
 }
 
@@ -82,12 +88,15 @@ void account_vtime(struct task_struct *tsk)
        cputime = S390_lowcore.user_timer >> 12;
        S390_lowcore.user_timer -= cputime << 12;
        S390_lowcore.steal_clock -= cputime << 12;
-       account_user_time(tsk, cputime);
+       account_user_time(tsk, cputime, cputime);
 
        cputime =  S390_lowcore.system_timer >> 12;
        S390_lowcore.system_timer -= cputime << 12;
        S390_lowcore.steal_clock -= cputime << 12;
-       account_system_time(tsk, 0, cputime);
+       if (idle_task(smp_processor_id()) != current)
+               account_system_time(tsk, 0, cputime, cputime);
+       else
+               account_idle_time(cputime);
 }
 
 /*
@@ -107,7 +116,10 @@ void account_system_vtime(struct task_struct *tsk)
        cputime =  S390_lowcore.system_timer >> 12;
        S390_lowcore.system_timer -= cputime << 12;
        S390_lowcore.steal_clock -= cputime << 12;
-       account_system_time(tsk, 0, cputime);
+       if (in_irq() || idle_task(smp_processor_id()) != current)
+               account_system_time(tsk, 0, cputime, cputime);
+       else
+               account_idle_time(cputime);
 }
 EXPORT_SYMBOL_GPL(account_system_vtime);