Skip to contentSkip to conversation

-mm: hard/softirq_ctx __read_mostly (CONFIG_4KSTACKS)

PATCH New Andreas Mohr 1 participant 1 message Apr 20, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 -mm: hard/softirq_ctx __read_mostly (CONFIG_4KSTACKS)

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.

arch/i386/kernel/irq.c +2 -2
@@ -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
 
 /*
arch/powerpc/kernel/irq.c +2 -2
@@ -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)
 {
Signature · 4 lines
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?)