summaryrefslogtreecommitdiff
path: root/include/linux/kernel_stat.h
diff options
context:
space:
mode:
authorZhen Lei <thunder.leizhen@huawei.com>2022-11-19 17:25:04 +0800
committerPaul E. McKenney <paulmck@kernel.org>2023-01-05 12:19:56 -0800
commit3ca0a6ea8f6de0f21a9331ff3596a9c073fbdab0 (patch)
tree4600604c19a83647318f3cfcbf0d8c89e57c3e33 /include/linux/kernel_stat.h
parent47904aed898a08f028572b9b5a5cc101ddfb2d82 (diff)
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>
Diffstat (limited to 'include/linux/kernel_stat.h')
-rw-r--r--include/linux/kernel_stat.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 90e2fdc17d79..898076e173a9 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];
}
+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
*/