This simple patch removes an unneeded indirection by mapping
ipipe_root_domain to &ipipe_root. Saves more than 7k kernel size with my
setup here when CONFIG_PREEMPT is enabled, and I bet it requires a few
cycles less as well.

Jan
---
 include/linux/ipipe.h   |    6 +++++-
 include/linux/preempt.h |    5 +++--
 kernel/ipipe/core.c     |    6 ++----
 3 files changed, 10 insertions(+), 7 deletions(-)

Index: linux-2.6.17.13/include/linux/ipipe.h
===================================================================
--- linux-2.6.17.13.orig/include/linux/ipipe.h
+++ linux-2.6.17.13/include/linux/ipipe.h
@@ -313,7 +313,11 @@ do {						\
 	local_irq_restore_hw(flags);		\
 } while (0)
 
-extern struct ipipe_domain *ipipe_percpu_domain[], *ipipe_root_domain;
+extern struct ipipe_domain *ipipe_percpu_domain[];
+
+extern struct ipipe_domain ipipe_root;
+
+#define ipipe_root_domain (&ipipe_root)
 
 extern unsigned __ipipe_printk_virq;
 
Index: linux-2.6.17.13/kernel/ipipe/core.c
===================================================================
--- linux-2.6.17.13.orig/kernel/ipipe/core.c
+++ linux-2.6.17.13/kernel/ipipe/core.c
@@ -29,12 +29,10 @@
 #include <linux/proc_fs.h>
 #endif	/* CONFIG_PROC_FS */
 
-static struct ipipe_domain ipipe_root =
+struct ipipe_domain ipipe_root =
 	{ .cpudata = {[0 ... IPIPE_NR_CPUS-1] =
 		{ .status = (1<<IPIPE_STALL_FLAG) } } };
 
-struct ipipe_domain *ipipe_root_domain = &ipipe_root;
-
 struct ipipe_domain *ipipe_percpu_domain[IPIPE_NR_CPUS] =
 	{[0 ... IPIPE_NR_CPUS - 1] = &ipipe_root };
 
@@ -1038,7 +1036,7 @@ EXPORT_SYMBOL(ipipe_control_irq);
 EXPORT_SYMBOL(ipipe_suspend_domain);
 EXPORT_SYMBOL(ipipe_alloc_virq);
 EXPORT_SYMBOL(ipipe_percpu_domain);
-EXPORT_SYMBOL(ipipe_root_domain);
+EXPORT_SYMBOL(ipipe_root);
 EXPORT_SYMBOL(ipipe_stall_pipeline_from);
 EXPORT_SYMBOL(ipipe_test_and_stall_pipeline_from);
 EXPORT_SYMBOL(ipipe_unstall_pipeline_from);
Index: linux-2.6.17.13/include/linux/preempt.h
===================================================================
--- linux-2.6.17.13.orig/include/linux/preempt.h
+++ linux-2.6.17.13/include/linux/preempt.h
@@ -29,8 +29,9 @@ asmlinkage void preempt_schedule(void);
 
 #ifdef CONFIG_IPIPE
 #include <asm/ipipe.h>
-extern struct ipipe_domain *ipipe_percpu_domain[], *ipipe_root_domain;
-#define ipipe_preempt_guard()	(ipipe_percpu_domain[ipipe_processor_id()] == ipipe_root_domain)
+extern struct ipipe_domain *ipipe_percpu_domain[];
+extern struct ipipe_domain ipipe_root;
+#define ipipe_preempt_guard()	(ipipe_percpu_domain[ipipe_processor_id()] == &ipipe_root)
 #else /* !CONFIG_IPIPE */
 #define ipipe_preempt_guard()	1
 #endif /* CONFIG_IPIPE */

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Reply via email to