Commit 8392853e authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar

rackmeter: Use vtime aware kcpustat accessor

Now that we have a vtime safe kcpustat accessor, use it to fetch
CPUTIME_NICE and fix frozen kcpustat values on nohz_full CPUs.
Reported-by: default avatarYauheni Kaliuta <yauheni.kaliuta@redhat.com>
Signed-off-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wanpeng Li <wanpengli@tencent.com>
Link: https://lkml.kernel.org/r/20191121024430.19938-7-frederic@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 8688f2fb
...@@ -81,13 +81,14 @@ static int rackmeter_ignore_nice; ...@@ -81,13 +81,14 @@ static int rackmeter_ignore_nice;
*/ */
static inline u64 get_cpu_idle_time(unsigned int cpu) static inline u64 get_cpu_idle_time(unsigned int cpu)
{ {
struct kernel_cpustat *kcpustat = &kcpustat_cpu(cpu);
u64 retval; u64 retval;
retval = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE] + retval = kcpustat->cpustat[CPUTIME_IDLE] +
kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; kcpustat->cpustat[CPUTIME_IOWAIT];
if (rackmeter_ignore_nice) if (rackmeter_ignore_nice)
retval += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; retval += kcpustat_field(kcpustat, CPUTIME_NICE, cpu);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment