irq: use per_cpu kstat_irqs
Use modern per_cpu API to increment {soft|hard}irq counters, and use
per_cpu allocation for (struct irq_desc)->kstats_irq instead of an array.
This gives better SMP/NUMA locality and saves few instructions per irq.
With small nr_cpuids values (8 for example), kstats_irq was a small array
(less than L1_CACHE_BYTES), potentially source of false sharing.
In the !CONFIG_SPARSE_IRQ case, remove the huge, NUMA/cache unfriendly
kstat_irqs_all[NR_IRQS][NR_CPUS] array.
Note: we still populate kstats_irq for all possible irqs in
early_irq_init(). We probably could use on-demand allocations. (Code
included in alloc_descs()). Problem is not all IRQS are used with a prior
alloc_descs() call.
kstat_irqs_this_cpu() is not used anymore, remove it.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
558bbb2fc7
commit
6c9ae009b2
@@ -46,16 +46,14 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
|
||||
extern unsigned long long nr_context_switches(void);
|
||||
|
||||
#ifndef CONFIG_GENERIC_HARDIRQS
|
||||
#define kstat_irqs_this_cpu(irq) \
|
||||
(this_cpu_read(kstat.irqs[irq])
|
||||
|
||||
struct irq_desc;
|
||||
|
||||
static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
|
||||
struct irq_desc *desc)
|
||||
{
|
||||
kstat_this_cpu.irqs[irq]++;
|
||||
kstat_this_cpu.irqs_sum++;
|
||||
__this_cpu_inc(kstat.irqs[irq]);
|
||||
__this_cpu_inc(kstat.irqs_sum);
|
||||
}
|
||||
|
||||
static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
|
||||
@@ -65,17 +63,18 @@ static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
|
||||
#else
|
||||
#include <linux/irq.h>
|
||||
extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
|
||||
#define kstat_irqs_this_cpu(DESC) \
|
||||
((DESC)->kstat_irqs[smp_processor_id()])
|
||||
#define kstat_incr_irqs_this_cpu(irqno, DESC) do {\
|
||||
((DESC)->kstat_irqs[smp_processor_id()]++);\
|
||||
kstat_this_cpu.irqs_sum++; } while (0)
|
||||
|
||||
#define kstat_incr_irqs_this_cpu(irqno, DESC) \
|
||||
do { \
|
||||
__this_cpu_inc(*(DESC)->kstat_irqs); \
|
||||
__this_cpu_inc(kstat.irqs_sum); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
static inline void kstat_incr_softirqs_this_cpu(unsigned int irq)
|
||||
{
|
||||
kstat_this_cpu.softirqs[irq]++;
|
||||
__this_cpu_inc(kstat.softirqs[irq]);
|
||||
}
|
||||
|
||||
static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
|
||||
|
||||
Reference in New Issue
Block a user