lkml.org 
[lkml]   [2019]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/6] leds: Use all-in-one vtime aware kcpustat accessor
On Thu, Nov 21, 2019 at 07:58:26AM +0100, Ingo Molnar wrote:
>
> * Frederic Weisbecker <frederic@kernel.org> wrote:
>
> > We can now safely read user kcpustat fields on nohz_full CPUs.
> > Use the appropriate accessor.
> >
> > Reported-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
> > Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> > Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> > Cc: Pavel Machek <pavel@ucw.cz>
> > Cc: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Rik van Riel <riel@surriel.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Wanpeng Li <wanpengli@tencent.com>
> > Cc: Ingo Molnar <mingo@kernel.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]
>
>
> :-)

Oops, I tested with vtime on and off but that one slipped under my config.
Do you want me to resend?

Thanks.

\
 
 \ /
  Last update: 2019-11-21 15:14    [W:0.049 / U:7.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site