Skip to content

Commit 8688f2f

Browse files
Frederic WeisbeckerIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]> Cc: Jacek Anaszewski <[email protected]> (maintainer:LED SUBSYSTEM) Cc: Pavel Machek <[email protected]> (maintainer:LED SUBSYSTEM) Cc: Dan Murphy <[email protected]> (reviewer:LED SUBSYSTEM) Cc: Peter Zijlstra <[email protected]> Cc: Wanpeng Li <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 5720821 commit 8688f2f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/leds/trigger/ledtrig-activity.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,15 @@ static void led_activity_function(struct timer_list *t)
5757
curr_used = 0;
5858

5959
for_each_possible_cpu(i) {
60-
curr_used += kcpustat_cpu(i).cpustat[CPUTIME_USER]
61-
+ kcpustat_cpu(i).cpustat[CPUTIME_NICE]
62-
+ kcpustat_field(&kcpustat_cpu(i), CPUTIME_SYSTEM, i)
63-
+ kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]
64-
+ kcpustat_cpu(i).cpustat[CPUTIME_IRQ];
60+
struct kernel_cpustat kcpustat;
61+
62+
kcpustat_cpu_fetch(&kcpustat, i);
63+
64+
curr_used += kcpustat.cpustat[CPUTIME_USER]
65+
+ kcpustat.cpustat[CPUTIME_NICE]
66+
+ kcpustat.cpustat[CPUTIME_SYSTEM]
67+
+ kcpustat.cpustat[CPUTIME_SOFTIRQ]
68+
+ kcpustat.cpustat[CPUTIME_IRQ];
6569
cpus++;
6670
}
6771

0 commit comments

Comments
 (0)