lkml.org 
[lkml]   [2005]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[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 <christoph@lameter.com>
Signed-off-by: Shai Fultheim <Shai@Scalex86.org>

Index: linux-2.6.11/arch/i386/kernel/apic.c
===================================================================
--- linux-2.6.11.orig/arch/i386/kernel/apic.c 2005-03-01
23:38:33.000000000 -0800
+++ linux-2.6.11/arch/i386/kernel/apic.c 2005-03-08
15:01:43.000000000 -0800
@@ -1165,7 +1165,7 @@ fastcall void smp_apic_timer_interrupt(s
/*
* 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,
Index: linux-2.6.11/arch/i386/kernel/io_apic.c
===================================================================
--- linux-2.6.11.orig/arch/i386/kernel/io_apic.c 2005-03-01
23:37:54.000000000 -0800
+++ linux-2.6.11/arch/i386/kernel/io_apic.c 2005-03-08
16:56:24.923078776 -0800
@@ -275,7 +275,7 @@ struct irq_cpu_info {
#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)

Index: linux-2.6.11/arch/i386/kernel/irq.c
===================================================================
--- linux-2.6.11.orig/arch/i386/kernel/irq.c 2005-03-01
23:37:48.000000000 -0800
+++ linux-2.6.11/arch/i386/kernel/irq.c 2005-03-08 17:57:13.623392016
-0800
@@ -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 @@ skip:
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));
Index: linux-2.6.11/arch/i386/kernel/nmi.c
===================================================================
--- linux-2.6.11.orig/arch/i386/kernel/nmi.c 2005-03-01
23:38:10.000000000 -0800
+++ linux-2.6.11/arch/i386/kernel/nmi.c 2005-03-08 15:01:43.000000000
-0800
@@ -110,7 +110,7 @@ int __init check_nmi_watchdog (void)
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 @@ void nmi_watchdog_tick (struct pt_regs *
*/
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) {
/*
Index: linux-2.6.11/arch/i386/kernel/process.c
===================================================================
--- linux-2.6.11.orig/arch/i386/kernel/process.c 2005-03-08
15:01:42.000000000 -0800
+++ linux-2.6.11/arch/i386/kernel/process.c 2005-03-08
18:06:03.695808760 -0800
@@ -161,7 +161,7 @@ void cpu_idle (void)
if (!idle)
idle = default_idle;

- irq_stat[cpu].idle_timestamp = jiffies;
+ __get_cpu_var(irq_stat).idle_timestamp =
jiffies;
idle();
}
schedule();
Index: linux-2.6.11/include/asm-i386/hardirq.h
===================================================================
--- linux-2.6.11.orig/include/asm-i386/hardirq.h 2005-03-01
23:38:17.000000000 -0800
+++ linux-2.6.11/include/asm-i386/hardirq.h 2005-03-08
18:10:52.545896872 -0800
@@ -12,8 +12,13 @@ typedef struct {
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 linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:11    [W:0.041 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site