diff options
Diffstat (limited to 'include/linux/kernel_stat.h')
| -rw-r--r-- | include/linux/kernel_stat.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index c059044bc6dc..0cce2db580c3 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
| @@ -33,6 +33,7 @@ struct kernel_stat { | |||
| 33 | #ifndef CONFIG_GENERIC_HARDIRQS | 33 | #ifndef CONFIG_GENERIC_HARDIRQS |
| 34 | unsigned int irqs[NR_IRQS]; | 34 | unsigned int irqs[NR_IRQS]; |
| 35 | #endif | 35 | #endif |
| 36 | unsigned long irqs_sum; | ||
| 36 | unsigned int softirqs[NR_SOFTIRQS]; | 37 | unsigned int softirqs[NR_SOFTIRQS]; |
| 37 | }; | 38 | }; |
| 38 | 39 | ||
| @@ -45,15 +46,14 @@ DECLARE_PER_CPU(struct kernel_stat, kstat); | |||
| 45 | extern unsigned long long nr_context_switches(void); | 46 | extern unsigned long long nr_context_switches(void); |
| 46 | 47 | ||
| 47 | #ifndef CONFIG_GENERIC_HARDIRQS | 48 | #ifndef CONFIG_GENERIC_HARDIRQS |
| 48 | #define kstat_irqs_this_cpu(irq) \ | ||
| 49 | (kstat_this_cpu.irqs[irq]) | ||
| 50 | 49 | ||
| 51 | struct irq_desc; | 50 | struct irq_desc; |
| 52 | 51 | ||
| 53 | static inline void kstat_incr_irqs_this_cpu(unsigned int irq, | 52 | static inline void kstat_incr_irqs_this_cpu(unsigned int irq, |
| 54 | struct irq_desc *desc) | 53 | struct irq_desc *desc) |
| 55 | { | 54 | { |
| 56 | kstat_this_cpu.irqs[irq]++; | 55 | __this_cpu_inc(kstat.irqs[irq]); |
| 56 | __this_cpu_inc(kstat.irqs_sum); | ||
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 59 | static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |
| @@ -63,16 +63,18 @@ static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | |||
| 63 | #else | 63 | #else |
| 64 | #include <linux/irq.h> | 64 | #include <linux/irq.h> |
| 65 | extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); | 65 | extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); |
| 66 | #define kstat_irqs_this_cpu(DESC) \ | 66 | |
| 67 | ((DESC)->kstat_irqs[smp_processor_id()]) | 67 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ |
| 68 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ | 68 | do { \ |
| 69 | ((DESC)->kstat_irqs[smp_processor_id()]++) | 69 | __this_cpu_inc(*(DESC)->kstat_irqs); \ |
| 70 | __this_cpu_inc(kstat.irqs_sum); \ | ||
| 71 | } while (0) | ||
| 70 | 72 | ||
| 71 | #endif | 73 | #endif |
| 72 | 74 | ||
| 73 | static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) | 75 | static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) |
| 74 | { | 76 | { |
| 75 | kstat_this_cpu.softirqs[irq]++; | 77 | __this_cpu_inc(kstat.softirqs[irq]); |
| 76 | } | 78 | } |
| 77 | 79 | ||
| 78 | static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu) | 80 | static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu) |
| @@ -83,6 +85,7 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu) | |||
| 83 | /* | 85 | /* |
| 84 | * Number of interrupts per specific IRQ source, since bootup | 86 | * Number of interrupts per specific IRQ source, since bootup |
| 85 | */ | 87 | */ |
| 88 | #ifndef CONFIG_GENERIC_HARDIRQS | ||
| 86 | static inline unsigned int kstat_irqs(unsigned int irq) | 89 | static inline unsigned int kstat_irqs(unsigned int irq) |
| 87 | { | 90 | { |
| 88 | unsigned int sum = 0; | 91 | unsigned int sum = 0; |
| @@ -93,7 +96,17 @@ static inline unsigned int kstat_irqs(unsigned int irq) | |||
| 93 | 96 | ||
| 94 | return sum; | 97 | return sum; |
| 95 | } | 98 | } |
| 99 | #else | ||
| 100 | extern unsigned int kstat_irqs(unsigned int irq); | ||
| 101 | #endif | ||
| 96 | 102 | ||
| 103 | /* | ||
| 104 | * Number of interrupts per cpu, since bootup | ||
| 105 | */ | ||
| 106 | static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu) | ||
| 107 | { | ||
| 108 | return kstat_cpu(cpu).irqs_sum; | ||
| 109 | } | ||
| 97 | 110 | ||
| 98 | /* | 111 | /* |
| 99 | * Lock/unlock the current runqueue - to extract task statistics: | 112 | * Lock/unlock the current runqueue - to extract task statistics: |
