Skip to contentSkip to conversation

s390: add read_mostly optimization.

PATCH In review Martin Schwidefsky 1 participant 1 message Apr 24, 2006 s390

lore
Share & tools
lore
#0 lore raw

PATCH 12/13 s390: add read_mostly optimization.

From: Christian Borntraeger <[email protected]>

[patch 12/13] s390: add read_mostly optimization.

Add a read_mostly section and define __read_mostly to prevent cache line pollution due to writes for mostly read variables. In addition fix the incorrect alignment of the cache_line_aligned data section. s390 has a cacheline size of 256 bytes.

---

 arch/s390/kernel/vmlinux.lds.S |    4 +++-
 include/asm-s390/cache.h       |    2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
arch/s390/kernel/vmlinux.lds.S +3 -1
diff -urpN linux-2.6/arch/s390/kernel/vmlinux.lds.S linux-2.6-patched/arch/s390/kernel/vmlinux.lds.S
@@ -58,9 +58,11 @@ SECTIONS
   . = ALIGN(4096);
   .data.page_aligned : { *(.data.idt) }
 
-  . = ALIGN(32);
+  . = ALIGN(256);
   .data.cacheline_aligned : { *(.data.cacheline_aligned) }
 
+  . = ALIGN(256);
+  .data.read_mostly : { *(.data.read_mostly) }
   _edata = .;			/* End of data section */
 
   . = ALIGN(8192);		/* init_task */
include/asm-s390/cache.h +2 -0
diff -urpN linux-2.6/include/asm-s390/cache.h linux-2.6-patched/include/asm-s390/cache.h
@@ -16,4 +16,6 @@
 
 #define ARCH_KMALLOC_MINALIGN	8
 
+#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+
 #endif