sched/vtime: Bring up complete kcpustat accessor
authorFrederic Weisbecker <frederic@kernel.org>
Thu, 21 Nov 2019 02:44:26 +0000 (03:44 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 21 Nov 2019 06:33:24 +0000 (07:33 +0100)
commit74722bb223d0f236303b60c9509ff924a9713780
tree8e29d87890a00e4377b0296f712c1e52ab1f0d7d
parent5a1c95580f1d89c8a736bb02ecd82a8858388b8a
sched/vtime: Bring up complete kcpustat accessor

Many callsites want to fetch the values of system, user, user_nice, guest
or guest_nice kcpustat fields altogether or at least a pair of these.

In that case calling kcpustat_field() for each requested field brings
unecessary overhead when we could fetch all of them in a row.

So provide kcpustat_cpu_fetch() that fetches the whole kcpustat array
in a vtime safe way under the same RCU and seqcount block.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wanpeng Li <wanpengli@tencent.com>
Cc: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Link: https://lkml.kernel.org/r/20191121024430.19938-3-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/kernel_stat.h
kernel/sched/cputime.c