2022-11-08 14:44:50

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH v5 2/4] sched: Add helper kstat_cpu_softirqs_sum()

Hi,

On 11/4/2022 7:41 PM, Zhen Lei wrote:
> Similar to kstat_cpu_irqs_sum(), it counts the sum of all software
> interrupts on a specified CPU.
>
> Signed-off-by: Zhen Lei <[email protected]>
> ---
> include/linux/kernel_stat.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
> index 90e2fdc17d79ff8..898076e173a928a 100644
> --- a/include/linux/kernel_stat.h
> +++ b/include/linux/kernel_stat.h
> @@ -67,6 +67,17 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
> return kstat_cpu(cpu).softirqs[irq];
> }
>

One header comment would have been good.

> +static inline unsigned int kstat_cpu_softirqs_sum(int cpu)
> +{
> + int i;
> + unsigned int sum = 0;
> +
> + for (i = 0; i < NR_SOFTIRQS; i++)
> + sum += kstat_softirqs_cpu(i, cpu);
> +
> + return sum;
> +}
> +
> /*
> * Number of interrupts per specific IRQ source, since bootup
> */

LGTM.
Reviewed-by: Mukesh Ojha <[email protected]>

-Mukesh


2022-11-08 19:15:10

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH v5 2/4] sched: Add helper kstat_cpu_softirqs_sum()

On Tue, Nov 08, 2022 at 08:00:56PM +0530, Mukesh Ojha wrote:
> Hi,
>
> On 11/4/2022 7:41 PM, Zhen Lei wrote:
> > Similar to kstat_cpu_irqs_sum(), it counts the sum of all software
> > interrupts on a specified CPU.
> >
> > Signed-off-by: Zhen Lei <[email protected]>
> > ---
> > include/linux/kernel_stat.h | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
> > index 90e2fdc17d79ff8..898076e173a928a 100644
> > --- a/include/linux/kernel_stat.h
> > +++ b/include/linux/kernel_stat.h
> > @@ -67,6 +67,17 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
> > return kstat_cpu(cpu).softirqs[irq];
> > }
>
> One header comment would have been good.

No argument, except that the other functions in this file are also quite
innocent of header comments. :-/

I have no idea what the maintainer(s) of this code would think of a
separate patch supplying the header comments.

> > +static inline unsigned int kstat_cpu_softirqs_sum(int cpu)
> > +{
> > + int i;
> > + unsigned int sum = 0;
> > +
> > + for (i = 0; i < NR_SOFTIRQS; i++)
> > + sum += kstat_softirqs_cpu(i, cpu);
> > +
> > + return sum;
> > +}
> > +
> > /*
> > * Number of interrupts per specific IRQ source, since bootup
> > */
>
> LGTM.
> Reviewed-by: Mukesh Ojha <[email protected]>

Applied all three, thank you!

Thanx, Paul