Skip to contentSkip to conversation

Add ia64 specific prefetch switch stack implementation

PATCH Chen, Kenneth W 1 participant 1 message Jul 27, 2005

lore
Share & tools
lore
#0 lore raw

This patch adds ia64 specific implementation to prefetch switch stack structure. It applies on top of "add prefetch switch stack hook ..." posted earlier. Using my favorite industry standard OLTP workload, we measured 6.2X reduction on cache misses occurred in the context switch code and yielded about 0.2% performance gain on large scale db setup.

arch/ia64/kernel/entry.S renamed from arch/ia64/kernel/entry.S.orig +23 -0
@@ -470,6 +470,29 @@ ENTRY(load_switch_stack)
 	br.cond.sptk.many b7
 END(load_switch_stack)
 
+GLOBAL_ENTRY(prefetch_switch_stack)
+	add r14 = -IA64_SWITCH_STACK_SIZE, sp
+	add r15 = IA64_TASK_THREAD_KSP_OFFSET, in0
+	;;
+	ld8 r16 = [r15]				// load next's stack pointer
+	lfetch.fault.excl [r14], 128
+	;;
+	lfetch.fault.excl [r14], 128
+	lfetch.fault [r16], 128
+	;;
+	lfetch.fault.excl [r14], 128
+	lfetch.fault [r16], 128
+	;;
+	lfetch.fault.excl [r14], 128
+	lfetch.fault [r16], 128
+	;;
+	lfetch.fault.excl [r14], 128
+	lfetch.fault [r16], 128
+	;;
+	lfetch.fault [r16], 128
+	br.ret.sptk.many rp
+END(prefetch_switch_stack)
+
 GLOBAL_ENTRY(execve)
 	mov r15=__NR_execve			// put syscall number in place
 	break __BREAK_SYSCALL
include/asm-ia64/system.h renamed from include/asm-ia64/system.h.orig +1 -0
@@ -274,6 +274,7 @@ extern void ia64_load_extra (struct task
  */
 #define __ARCH_WANT_UNLOCKED_CTXSW
 
+#define ARCH_HAS_PREFETCH_SWITCH_STACK
 #define ia64_platform_is(x) (strcmp(x, platform_name) = 0)
 
 void cpu_idle_wait(void);