Skip to content

Commit 3ca0a6e

Browse files
Zhen Leipaulmckrcu
authored andcommitted
sched: Add helper kstat_cpu_softirqs_sum()
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 <peterz@infradead.org> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 47904ae commit 3ca0a6e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

include/linux/kernel_stat.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
6767
return kstat_cpu(cpu).softirqs[irq];
6868
}
6969

70+
static inline unsigned int kstat_cpu_softirqs_sum(int cpu)
71+
{
72+
int i;
73+
unsigned int sum = 0;
74+
75+
for (i = 0; i < NR_SOFTIRQS; i++)
76+
sum += kstat_softirqs_cpu(i, cpu);
77+
78+
return sum;
79+
}
80+
7081
/*
7182
* Number of interrupts per specific IRQ source, since bootup
7283
*/

0 commit comments

Comments
 (0)