Skip to content

Commit

Permalink
sched: Add helper kstat_cpu_softirqs_sum()
Browse files Browse the repository at this point in the history
Add a kstat_cpu_softirqs_sum() function that is similar to
kstat_cpu_irqs_sum(), but which counts software interrupts since boot
on the specified CPU.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Josh Don <joshdon@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: "Peter Zijlstra (Intel)"
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
  • Loading branch information
Zhen Lei authored and Paul E. McKenney committed Nov 21, 2022
1 parent 51b2573 commit 1325032
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/linux/kernel_stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
return kstat_cpu(cpu).softirqs[irq];
}

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
*/
Expand Down

0 comments on commit 1325032

Please sign in to comment.