A new atomic variable nr_active_irqs is added to track the number of active IRQs that have one or more interrupts serviced. Signed-off-by: Waiman Long <longman@xxxxxxxxxx> --- kernel/irq/internals.h | 7 +++++-- kernel/irq/irqdesc.c | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index 31787c1..239ae51 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -242,10 +242,13 @@ static inline void irq_state_set_masked(struct irq_desc *desc) #undef __irqd_to_state +extern atomic_t nr_active_irqs; /* # of active IRQs */ static inline void kstat_incr_irqs_this_cpu(struct irq_desc *desc) { - if (unlikely(__this_cpu_inc_return(*desc->kstat_irqs) == 1)) - atomic_inc(&desc->kstat_irq_cpus); + if (unlikely(__this_cpu_inc_return(*desc->kstat_irqs) == 1)) { + if (atomic_inc_return(&desc->kstat_irq_cpus) == 1) + atomic_inc(&nr_active_irqs); + } __this_cpu_inc(kstat.irqs_sum); } diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 3d2c38b..7e00c4d 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -20,6 +20,11 @@ #include "internals.h" /* + * Number of active IRQs + */ +atomic_t nr_active_irqs; + +/* * lockdep: we want to handle all irq_desc locks as a single lock-class: */ static struct lock_class_key irq_desc_lock_class; -- 1.8.3.1