acct: Convert obsolete cputime type to nsecs
authorFrederic Weisbecker <fweisbec@gmail.com>
Tue, 31 Jan 2017 03:09:28 +0000 (04:09 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 1 Feb 2017 08:13:51 +0000 (09:13 +0100)
Use the new nsec based cputime accessors as part of the whole cputime
conversion from cputime_t to nsecs.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1485832191-26889-13-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/sched.h
kernel/acct.c

index b7ccc54b35cc66a669fcd823b96affef09511e83..75fc773c158d7b148643fc8d5c766d2bcb6391e6 100644 (file)
@@ -563,7 +563,7 @@ struct pacct_struct {
        int                     ac_flag;
        long                    ac_exitcode;
        unsigned long           ac_mem;
-       cputime_t               ac_utime, ac_stime;
+       u64                     ac_utime, ac_stime;
        unsigned long           ac_minflt, ac_majflt;
 };
 
index b9b190a8eecf084968a7c7628897eccd7cae1ea6..ca9cb55b585599bcf78c78adc7117e70f23d6c33 100644 (file)
@@ -453,8 +453,8 @@ static void fill_ac(acct_t *ac)
        spin_lock_irq(&current->sighand->siglock);
        tty = current->signal->tty;     /* Safe as we hold the siglock */
        ac->ac_tty = tty ? old_encode_dev(tty_devnum(tty)) : 0;
-       ac->ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime)));
-       ac->ac_stime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_stime)));
+       ac->ac_utime = encode_comp_t(nsec_to_AHZ(pacct->ac_utime));
+       ac->ac_stime = encode_comp_t(nsec_to_AHZ(pacct->ac_stime));
        ac->ac_flag = pacct->ac_flag;
        ac->ac_mem = encode_comp_t(pacct->ac_mem);
        ac->ac_minflt = encode_comp_t(pacct->ac_minflt);
@@ -530,7 +530,7 @@ out:
 void acct_collect(long exitcode, int group_dead)
 {
        struct pacct_struct *pacct = &current->signal->pacct;
-       cputime_t utime, stime;
+       u64 utime, stime;
        unsigned long vsize = 0;
 
        if (group_dead && current->mm) {
@@ -559,7 +559,8 @@ void acct_collect(long exitcode, int group_dead)
                pacct->ac_flag |= ACORE;
        if (current->flags & PF_SIGNALED)
                pacct->ac_flag |= AXSIG;
-       task_cputime_t(current, &utime, &stime);
+
+       task_cputime(current, &utime, &stime);
        pacct->ac_utime += utime;
        pacct->ac_stime += stime;
        pacct->ac_minflt += current->min_flt;