• Peter Zijlstra's avatar
    sched/cputime: Fix NO_HZ_FULL getrusage() monotonicity regression · c3cf68ec
    Peter Zijlstra authored
    commit 173be9a1 upstream.
    
    Mike reports:
    
     Roughly 10% of the time, ltp testcase getrusage04 fails:
     getrusage04    0  TINFO  :  Expected timers granularity is 4000 us
     getrusage04    0  TINFO  :  Using 1 as multiply factor for max [us]time increment (1000+4000us)!
     getrusage04    0  TINFO  :  utime:           0us; stime:         179us
     getrusage04    0  TINFO  :  utime:        3751us; stime:           0us
     getrusage04    1  TFAIL  :  getrusage04.c:133: stime increased > 5000us:
    
    And tracked it down to the case where the task simply doesn't get
    _any_ [us]time ticks.
    
    Update the code to assume all rtime is utime when we lack information,
    thus ensuring a task that elides the tick gets time accounted.
    Reported-by: default avatarMike Galbraith <umgwanakikbuti@gmail.com>
    Tested-by: default avatarMike Galbraith <umgwanakikbuti@gmail.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Fredrik Markstrom <fredrik.markstrom@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Radim <rkrcmar@redhat.com>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Cc: Wanpeng Li <wanpeng.li@hotmail.com>
    Fixes: 9d7fb042 ("sched/cputime: Guarantee stime + utime == rtime")
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    c3cf68ec
cputime.c 22.7 KB