All of lore.kernel.org
 help / color / mirror / Atom feed
* [Adeos-main] [PATCH 1/5] x86: optimize access to __ipipe_tick_regs
@ 2007-12-29 23:12 Jan Kiszka
  2007-12-30 10:31 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2007-12-29 23:12 UTC (permalink / raw)
  To: adeos-main; +Cc: Philippe Gerum


[-- Attachment #1.1: Type: text/plain, Size: 267 bytes --]

By intention, the compiler is not able to fold succeeding accesses to
via __raw_get_cpu_var & friends into a single one. As we are in an
atomic section in __ipipe_handle_irq, let's help him with a temporary
variable, saving some text size in this hotpath.

Jan

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: optimize-regs-saving.patch --]
[-- Type: text/x-patch; name="optimize-regs-saving.patch", Size: 1917 bytes --]

---
 arch/x86/kernel/ipipe_32.c |    9 +++++----
 arch/x86/kernel/ipipe_64.c |   13 +++++++------
 2 files changed, 12 insertions(+), 10 deletions(-)

Index: linux-2.6.24-rc6-xeno/arch/x86/kernel/ipipe_32.c
===================================================================
--- linux-2.6.24-rc6-xeno.orig/arch/x86/kernel/ipipe_32.c
+++ linux-2.6.24-rc6-xeno/arch/x86/kernel/ipipe_32.c
@@ -771,10 +771,11 @@ finalize:
 	 * information. */
 
 	if (irq == __ipipe_tick_irq) {
-		__raw_get_cpu_var(__ipipe_tick_regs).eflags = regs.eflags;
-		__raw_get_cpu_var(__ipipe_tick_regs).eip = regs.eip;
-		__raw_get_cpu_var(__ipipe_tick_regs).xcs = regs.xcs;
-		__raw_get_cpu_var(__ipipe_tick_regs).ebp = regs.ebp;
+		struct pt_regs *tick_regs = &__raw_get_cpu_var(__ipipe_tick_regs);
+		tick_regs->eflags = regs.eflags;
+		tick_regs->xcs = regs.xcs;
+		tick_regs->eip = regs.eip;
+		tick_regs->ebp = regs.ebp;
 	}
 
 	/*
Index: linux-2.6.24-rc6-xeno/arch/x86/kernel/ipipe_64.c
===================================================================
--- linux-2.6.24-rc6-xeno.orig/arch/x86/kernel/ipipe_64.c
+++ linux-2.6.24-rc6-xeno/arch/x86/kernel/ipipe_64.c
@@ -751,12 +751,13 @@ int __ipipe_handle_irq(struct pt_regs *r
 finalize:
 
 	if (irq == __ipipe_tick_irq) {
-		__raw_get_cpu_var(__ipipe_tick_regs).rip = regs->rip;
-		__raw_get_cpu_var(__ipipe_tick_regs).cs = regs->cs;
-		__raw_get_cpu_var(__ipipe_tick_regs).eflags = regs->eflags;
-		__raw_get_cpu_var(__ipipe_tick_regs).rbp = regs->rbp;
-		__raw_get_cpu_var(__ipipe_tick_regs).rsp = regs->rsp;
-		__raw_get_cpu_var(__ipipe_tick_regs).ss = regs->ss;
+		struct pt_regs *tick_regs = &__raw_get_cpu_var(__ipipe_tick_regs);
+		tick_regs->ss = regs->ss;
+		tick_regs->rsp = regs->rsp;
+		tick_regs->eflags = regs->eflags;
+		tick_regs->cs = regs->cs;
+		tick_regs->rip = regs->rip;
+		tick_regs->rbp = regs->rbp;
 	}
 
 	/*

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-30 10:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-29 23:12 [Adeos-main] [PATCH 1/5] x86: optimize access to __ipipe_tick_regs Jan Kiszka
2007-12-30 10:31 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.