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.
Index: 2.6.13-rc2a/arch/i386/kernel/vmlinux.lds.S
===================================================================
--- 2.6.13-rc2a.orig/arch/i386/kernel/vmlinux.lds.S
+++ 2.6.13-rc2a/arch/i386/kernel/vmlinux.lds.S
@@ -23,6 +23,7 @@
SCHED_TEXT
LOCK_TEXT
*(.fixup)
+ *(.slow.text)
*(.gnu.warning)
} = 0x9090
Index: 2.6.13-rc2a/arch/ppc/kernel/vmlinux.lds.S
===================================================================
--- 2.6.13-rc2a.orig/arch/ppc/kernel/vmlinux.lds.S
+++ 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)
Index: 2.6.13-rc2a/arch/ppc64/kernel/vmlinux.lds.S
===================================================================
--- 2.6.13-rc2a.orig/arch/ppc64/kernel/vmlinux.lds.S
+++ 2.6.13-rc2a/arch/ppc64/kernel/vmlinux.lds.S
@@ -16,6 +16,7 @@
SCHED_TEXT
LOCK_TEXT
*(.fixup)
+ *(.slow.text)
. = ALIGN(4096);
_etext = .;
}
Index: 2.6.13-rc2a/arch/x86_64/kernel/vmlinux.lds.S
===================================================================
--- 2.6.13-rc2a.orig/arch/x86_64/kernel/vmlinux.lds.S
+++ 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 */
Index: 2.6.13-rc2a/include/linux/compiler.h
===================================================================
--- 2.6.13-rc2a.orig/include/linux/compiler.h
+++ 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:
Index: 2.6.13-rc2a/arch/i386/kernel/irq.c
===================================================================
--- 2.6.13-rc2a.orig/arch/i386/kernel/irq.c
+++ 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|