[tip: sched/core] leds: Use all-in-one vtime aware kcpustat accessor
From: tip-bot2 for Frederic Weisbecker
Date: Thu Nov 21 2019 - 11:48:26 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 8688f2fb671b2ed59b1b16083136b6edc3750435
Gitweb: https://git.kernel.org/tip/8688f2fb671b2ed59b1b16083136b6edc3750435
Author: Frederic Weisbecker <frederic@xxxxxxxxxx>
AuthorDate: Thu, 21 Nov 2019 03:44:29 +01:00
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitterDate: Thu, 21 Nov 2019 07:58:48 +01:00
leds: Use all-in-one vtime aware kcpustat accessor
We can now safely read user kcpustat fields on nohz_full CPUs.
Use the appropriate accessor.
[ mingo: Fixed build failure. ]
Reported-by: Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxxx>
Signed-off-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
Cc: Jacek Anaszewski <jacek.anaszewski@xxxxxxxxx> (maintainer:LED SUBSYSTEM)
Cc: Pavel Machek <pavel@xxxxxx> (maintainer:LED SUBSYSTEM)
Cc: Dan Murphy <dmurphy@xxxxxx> (reviewer:LED SUBSYSTEM)
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Wanpeng Li <wanpengli@xxxxxxxxxxx>
Link: https://lkml.kernel.org/r/20191121024430.19938-6-frederic@xxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
drivers/leds/trigger/ledtrig-activity.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/leds/trigger/ledtrig-activity.c b/drivers/leds/trigger/ledtrig-activity.c
index ddfc5ed..14ba7fa 100644
--- a/drivers/leds/trigger/ledtrig-activity.c
+++ b/drivers/leds/trigger/ledtrig-activity.c
@@ -57,11 +57,15 @@ static void led_activity_function(struct timer_list *t)
curr_used = 0;
for_each_possible_cpu(i) {
- curr_used += kcpustat_cpu(i).cpustat[CPUTIME_USER]
- + kcpustat_cpu(i).cpustat[CPUTIME_NICE]
- + kcpustat_field(&kcpustat_cpu(i), CPUTIME_SYSTEM, i)
- + kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]
- + kcpustat_cpu(i).cpustat[CPUTIME_IRQ];
+ struct kernel_cpustat kcpustat;
+
+ kcpustat_cpu_fetch(&kcpustat, i);
+
+ curr_used += kcpustat.cpustat[CPUTIME_USER]
+ + kcpustat.cpustat[CPUTIME_NICE]
+ + kcpustat.cpustat[CPUTIME_SYSTEM]
+ + kcpustat.cpustat[CPUTIME_SOFTIRQ]
+ + kcpustat.cpustat[CPUTIME_IRQ];
cpus++;
}