summary refs log tree commit diff
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorFrederic Weisbecker <frederic@kernel.org>2019-11-21 03:44:30 +0100
committerIngo Molnar <mingo@kernel.org>2019-11-21 07:59:00 +0100
commit8392853e964c025b0616bd54c0cdf9cbc3c9a769 (patch)
tree9730d88138caf16018b9978320acd0d8a041067c /drivers/macintosh
parent8688f2fb671b2ed59b1b16083136b6edc3750435 (diff)
downloadlinux-8392853e964c025b0616bd54c0cdf9cbc3c9a769.tar.gz
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: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Signed-off-by: Frederic 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.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/rack-meter.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index 4134e580f786..60311e8d6240 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -81,13 +81,14 @@ static int rackmeter_ignore_nice;
  */
 static inline u64 get_cpu_idle_time(unsigned int cpu)
 {
+	struct kernel_cpustat *kcpustat = &kcpustat_cpu(cpu);
 	u64 retval;
 
-	retval = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE] +
-		 kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
+	retval = kcpustat->cpustat[CPUTIME_IDLE] +
+		 kcpustat->cpustat[CPUTIME_IOWAIT];
 
 	if (rackmeter_ignore_nice)
-		retval += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE];
+		retval += kcpustat_field(kcpustat, CPUTIME_NICE, cpu);
 
 	return retval;
 }