[PATCH] -mm: hard/softirq_ctx __read_mostly (CONFIG_4KSTACKS)

From: Andreas Mohr
Date: Thu Apr 20 2006 - 13:27:41 EST


Hello all,

the hardirq_ctx and softirq_ctx variables are written to on init only,
but in the final kernel image they may easily get linked together with other
often-written variables in the same cacheline, so put them into __read_mostly
section since they are in the highly critical IRQ path.

Patch compiled and tested on 2.6.17-rc1-mm3.
I did not test the powerpc part, though, for obvious reasons.

Signed-off-by: Andreas Mohr <andi@xxxxxxxx>


--- linux-2.6.17-rc1-mm3.orig/arch/i386/kernel/irq.c 2006-04-18 11:46:04.000000000 +0200
+++ linux-2.6.17-rc1-mm3/arch/i386/kernel/irq.c 2006-04-20 18:33:14.000000000 +0200
@@ -42,8 +42,8 @@
u32 stack[THREAD_SIZE/sizeof(u32)];
};

-static union irq_ctx *hardirq_ctx[NR_CPUS];
-static union irq_ctx *softirq_ctx[NR_CPUS];
+static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
+static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
#endif

/*
--- linux-2.6.17-rc1-mm3.orig/arch/powerpc/kernel/irq.c 2006-04-20 18:47:22.000000000 +0200
+++ linux-2.6.17-rc1-mm3/arch/powerpc/kernel/irq.c 2006-04-20 19:19:25.000000000 +0200
@@ -379,8 +379,8 @@
#endif /* CONFIG_PPC64 */

#ifdef CONFIG_IRQSTACKS
-struct thread_info *softirq_ctx[NR_CPUS];
-struct thread_info *hardirq_ctx[NR_CPUS];
+struct thread_info *softirq_ctx[NR_CPUS] __read_mostly;
+struct thread_info *hardirq_ctx[NR_CPUS] __read_mostly;

void irq_ctx_init(void)
{



--
No programming skills!? Why not help translate many Linux applications!
https://launchpad.ubuntu.com/rosetta
(or alternatively buy nicely packaged Linux distros/OSS software to help
support Linux developers creating shiny new things for you?)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/