Skip to contentSkip to conversation

Text section for "slow" code

PATCH New Chuck Ebbert 1 participant 1 message Jul 10, 2005 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Text section for "slow" code

I came up with this patch for moving slow code to its own section, but some questions arose:

1. How to implement for each arch?

2. What name to use for the text section?

Patch for X86 and PPC follows, then a test patch for i386 to show it boots and runs.

arch/i386/kernel/vmlinux.lds.S +1 -0
Index: 2.6.13-rc2a/arch/i386/kernel/vmlinux.lds.S
===================================================================
@@ -23,6 +23,7 @@
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)
+	*(.slow.text)
 	*(.gnu.warning)
 	} = 0x9090
 
arch/ppc/kernel/vmlinux.lds.S +1 -0
Index: 2.6.13-rc2a/arch/ppc/kernel/vmlinux.lds.S
===================================================================
@@ -34,6 +34,7 @@
     SCHED_TEXT
     LOCK_TEXT
     *(.fixup)
+    *(.slow.text)
     *(.got1)
     __got2_start = .;
     *(.got2)
arch/ppc64/kernel/vmlinux.lds.S +1 -0
Index: 2.6.13-rc2a/arch/ppc64/kernel/vmlinux.lds.S
===================================================================
@@ -16,6 +16,7 @@
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)
+	*(.slow.text)
 	. = ALIGN(4096);
 	_etext = .;
 	}
arch/x86_64/kernel/vmlinux.lds.S +1 -0
Index: 2.6.13-rc2a/arch/x86_64/kernel/vmlinux.lds.S
===================================================================
@@ -22,6 +22,7 @@
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)
+	*(.slow.text)
 	*(.gnu.warning)
 	} = 0x9090
   				/* out-of-line lock text */
include/linux/compiler.h +11 -0
Index: 2.6.13-rc2a/include/linux/compiler.h
===================================================================
@@ -48,6 +48,17 @@
 # error Sorry, your compiler is too old/not recognized.
 #endif
 
+/* Text section for code that is not speed-critical.
+ * Temporary hack includes arch-specific test in generic header.
+ */
+#if defined(CONFIG_X86) || defined(CONFIG_PPC)
+# define __slow		noinline __attribute__((__section__(".slow.text")))
+#endif
+
+#if !defined(__slow)
+# define __slow		noinline
+#endif
+
 /* Intel compiler defines __GNUC__. So we will overwrite implementations
  * coming from above header files here
  */

=======================================================================================

Test patch:

arch/i386/kernel/irq.c +1 -1
Index: 2.6.13-rc2a/arch/i386/kernel/irq.c
===================================================================
@@ -210,7 +210,7 @@
  * /proc/interrupts printing:
  */
 
-int show_interrupts(struct seq_file *p, void *v)
+int __slow show_interrupts(struct seq_file *p, void *v)
 {
 	int i = *(loff_t *) v, j;
 	struct irqaction * action;

--
Chuck