diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-02-23 16:40:14 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-03-04 11:37:53 -0500 |
commit | 792d0018a5fe31ef8ef9d07a7a02081d4abdf6b7 (patch) | |
tree | 478e4cb710e6c3598451e56a3860bc3c976f857e | |
parent | 02893afdd310fab8f41f6afbe5233c6609ec19ed (diff) |
genirq: Add a kstat helper to increment irq stats
There is a common pattern all over the place:
kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));
This results in a call to core code anyway. So provide a function
which does the same thing in core.
While at it, replace the butt ugly macro with an inline.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140223212737.422068876@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/kernel_stat.h | 12 | ||||
-rw-r--r-- | kernel/irq/irqdesc.c | 5 |
2 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 51c72be4a7c3..54ec7e0a7d72 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
@@ -54,11 +54,13 @@ extern unsigned long long nr_context_switches(void); | |||
54 | #include <linux/irq.h> | 54 | #include <linux/irq.h> |
55 | extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); | 55 | extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); |
56 | 56 | ||
57 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ | 57 | static inline void kstat_incr_irqs_this_cpu(unsigned int irq, struct irq_desc *desc) |
58 | do { \ | 58 | { |
59 | __this_cpu_inc(*(DESC)->kstat_irqs); \ | 59 | __this_cpu_inc(*desc->kstat_irqs); |
60 | __this_cpu_inc(kstat.irqs_sum); \ | 60 | __this_cpu_inc(kstat.irqs_sum); |
61 | } while (0) | 61 | } |
62 | |||
63 | extern void kstat_incr_irq_this_cpu(unsigned int irq); | ||
62 | 64 | ||
63 | static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) | 65 | static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) |
64 | { | 66 | { |
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 8ab8e9390297..a7174617616b 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c | |||
@@ -489,6 +489,11 @@ void dynamic_irq_cleanup(unsigned int irq) | |||
489 | raw_spin_unlock_irqrestore(&desc->lock, flags); | 489 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
490 | } | 490 | } |
491 | 491 | ||
492 | void kstat_incr_irq_this_cpu(unsigned int irq) | ||
493 | { | ||
494 | kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); | ||
495 | } | ||
496 | |||
492 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 497 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |
493 | { | 498 | { |
494 | struct irq_desc *desc = irq_to_desc(irq); | 499 | struct irq_desc *desc = irq_to_desc(irq); |