[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191121065826.GA3552@gmail.com>
Date: Thu, 21 Nov 2019 07:58:26 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Wanpeng Li <wanpengli@...cent.com>,
"Rafael J . Wysocki" <rjw@...ysocki.net>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Rik van Riel <riel@...riel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Yauheni Kaliuta <yauheni.kaliuta@...hat.com>,
Viresh Kumar <viresh.kumar@...aro.org>,
Pavel Machek <pavel@....cz>
Subject: Re: [PATCH 5/6] leds: Use all-in-one vtime aware kcpustat accessor
* Frederic Weisbecker <frederic@...nel.org> wrote:
> We can now safely read user kcpustat fields on nohz_full CPUs.
> Use the appropriate accessor.
>
> Reported-by: Yauheni Kaliuta <yauheni.kaliuta@...hat.com>
> Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> Cc: Jacek Anaszewski <jacek.anaszewski@...il.com>
> Cc: Pavel Machek <pavel@....cz>
> Cc: Yauheni Kaliuta <yauheni.kaliuta@...hat.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Rik van Riel <riel@...riel.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Wanpeng Li <wanpengli@...cent.com>
> Cc: Ingo Molnar <mingo@...nel.org>
> ---
> 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 ddfc5edd07c8..6901e3631c22 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_fetch_cpu(&kcpustat, i);
> +
> + curr_used += kcpustat.cpustat[CPUTIME_USER]
> + + kcpustat.cpustat[CPUTIME_NICE]
> + + kcpustat.cpustat[CPUTIME_SYSTEM]
> + + kcpustat.cpustat[CPUTIME_SOFTIRQ]
> + + kcpustat.cpustat[CPUTIME_IRQ];
Not the best tested series:
--- a/drivers/leds/trigger/ledtrig-activity.c
+++ b/drivers/leds/trigger/ledtrig-activity.c
@@ -59,7 +59,7 @@ static void led_activity_function(struct timer_list *t)
for_each_possible_cpu(i) {
struct kernel_cpustat kcpustat;
- kcpustat_fetch_cpu(&kcpustat, i);
+ kcpustat_cpu_fetch(&kcpustat, i);
curr_used += kcpustat.cpustat[CPUTIME_USER]
+ kcpustat.cpustat[CPUTIME_NICE]
:-)
Thanks,
Ingo
Powered by blists - more mailing lists