ChangeSet 1.2231.1.144, 2005/03/28 19:56:31-08:00, [EMAIL PROTECTED]

        [PATCH] Per cpu irq stat
        
        The definition of the irq_stat as an array means that the individual
        elements of the irq_stat array are located on one NUMA node requiring
        internode traffic to access irq_stat from other nodes.  This patch makes
        irq_stat a per_cpu variable which allows most accesses to be local.
        
        Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>
        Signed-off-by: Shai Fultheim <[EMAIL PROTECTED]>
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>



 arch/i386/kernel/apic.c    |    2 +-
 arch/i386/kernel/io_apic.c |    2 +-
 arch/i386/kernel/irq.c     |    5 ++++-
 arch/i386/kernel/nmi.c     |    4 ++--
 arch/i386/kernel/process.c |    2 +-
 include/asm-i386/hardirq.h |    7 ++++++-
 6 files changed, 15 insertions(+), 7 deletions(-)


diff -Nru a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
--- a/arch/i386/kernel/apic.c   2005-03-28 21:38:10 -08:00
+++ b/arch/i386/kernel/apic.c   2005-03-28 21:38:10 -08:00
@@ -1165,7 +1165,7 @@
        /*
         * the NMI deadlock-detector uses this.
         */
-       irq_stat[cpu].apic_timer_irqs++;
+       per_cpu(irq_stat, cpu).apic_timer_irqs++;
 
        /*
         * NOTE! We'd better ACK the irq immediately,
diff -Nru a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
--- a/arch/i386/kernel/io_apic.c        2005-03-28 21:38:10 -08:00
+++ b/arch/i386/kernel/io_apic.c        2005-03-28 21:38:10 -08:00
@@ -275,7 +275,7 @@
 #define IRQ_DELTA(cpu,irq)     (irq_cpu_data[cpu].irq_delta[irq])
 
 #define IDLE_ENOUGH(cpu,now) \
-               (idle_cpu(cpu) && ((now) - irq_stat[(cpu)].idle_timestamp > 1))
+       (idle_cpu(cpu) && ((now) - per_cpu(irq_stat, (cpu)).idle_timestamp > 1))
 
 #define IRQ_ALLOWED(cpu, allowed_mask) cpu_isset(cpu, allowed_mask)
 
diff -Nru a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
--- a/arch/i386/kernel/irq.c    2005-03-28 21:38:10 -08:00
+++ b/arch/i386/kernel/irq.c    2005-03-28 21:38:10 -08:00
@@ -16,6 +16,9 @@
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
 
+DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_maxaligned_in_smp;
+EXPORT_PER_CPU_SYMBOL(irq_stat);
+
 #ifndef CONFIG_X86_LOCAL_APIC
 /*
  * 'what should we do if we get a hw irq event on an illegal vector'.
@@ -246,7 +249,7 @@
                for (j = 0; j < NR_CPUS; j++)
                        if (cpu_online(j))
                                seq_printf(p, "%10u ",
-                                       irq_stat[j].apic_timer_irqs);
+                                       per_cpu(irq_stat,j).apic_timer_irqs);
                seq_putc(p, '\n');
 #endif
                seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
diff -Nru a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
--- a/arch/i386/kernel/nmi.c    2005-03-28 21:38:10 -08:00
+++ b/arch/i386/kernel/nmi.c    2005-03-28 21:38:10 -08:00
@@ -110,7 +110,7 @@
        printk(KERN_INFO "testing NMI watchdog ... ");
 
        for (cpu = 0; cpu < NR_CPUS; cpu++)
-               prev_nmi_count[cpu] = irq_stat[cpu].__nmi_count;
+               prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
        local_irq_enable();
        mdelay((10*1000)/nmi_hz); // wait 10 ticks
 
@@ -483,7 +483,7 @@
         */
        int sum, cpu = smp_processor_id();
 
-       sum = irq_stat[cpu].apic_timer_irqs;
+       sum = per_cpu(irq_stat, cpu).apic_timer_irqs;
 
        if (last_irq_sums[cpu] == sum) {
                /*
diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c        2005-03-28 21:38:10 -08:00
+++ b/arch/i386/kernel/process.c        2005-03-28 21:38:10 -08:00
@@ -161,7 +161,7 @@
                        if (!idle)
                                idle = default_idle;
 
-                       irq_stat[cpu].idle_timestamp = jiffies;
+                       __get_cpu_var(irq_stat).idle_timestamp = jiffies;
                        idle();
                }
                schedule();
diff -Nru a/include/asm-i386/hardirq.h b/include/asm-i386/hardirq.h
--- a/include/asm-i386/hardirq.h        2005-03-28 21:38:10 -08:00
+++ b/include/asm-i386/hardirq.h        2005-03-28 21:38:10 -08:00
@@ -12,8 +12,13 @@
        unsigned int apic_timer_irqs;   /* arch dependent */
 } ____cacheline_aligned irq_cpustat_t;
 
-#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
+DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
+extern irq_cpustat_t irq_stat[];
+
+#define __ARCH_IRQ_STAT
+#define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member)
 
 void ack_bad_irq(unsigned int irq);
+#include <linux/irq_cpustat.h>
 
 #endif /* __ASM_HARDIRQ_H */
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to