sched/kcpustat: Introduce vtime-aware kcpustat accessor for CPUTIME_SYSTEM
authorFrederic Weisbecker <frederic@kernel.org>
Fri, 25 Oct 2019 02:03:03 +0000 (04:03 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 29 Oct 2019 09:01:17 +0000 (10:01 +0100)
commit64eea63c19a2c386a96638f4e54a1355510709e3
treee0469223fe098bb8b0a03ce06ba586a0bd9f9567
parent023e9deb51c9e1aafacbd421e55beadcb8e87f53
sched/kcpustat: Introduce vtime-aware kcpustat accessor for CPUTIME_SYSTEM

Kcpustat is not correctly supported on nohz_full CPUs. The tick doesn't
fire and the cputime therefore doesn't move forward. The issue has shown
up after the vanishing of the remaining 1Hz which has made the stall
visible.

We are solving that with checking the task running on a CPU through RCU
and reading its vtime delta that we add to the raw kcpustat values.

We make sure that we fetch a coherent raw-kcpustat/vtime-delta couple
sequence while checking that the CPU referred by the target vtime is the
correct one, under the locked vtime seqcount.

Only CPUTIME_SYSTEM is handled here as a start because it's the trivial
case. User and guest time will require more preparation work to
correctly handle niceness.

Reported-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpengli@tencent.com>
Link: https://lkml.kernel.org/r/20191025020303.19342-1-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/kernel_stat.h
kernel/sched/cputime.c