From: Mikael Pettersson <mikpe@csd.uu.se>

- Move perfctr_suspend_thread() call from __switch_to() to the beginning
  of switch_to().  Ensures that suspend actions are done when the owner
  task still is 'current'.

Signed-off-by: Mikael Pettersson <mikpe@csd.uu.se>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/i386/kernel/process.c |    2 --
 25-akpm/include/asm-i386/system.h  |    1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff -puN arch/i386/kernel/process.c~perfctr-x86-core-updates arch/i386/kernel/process.c
--- 25/arch/i386/kernel/process.c~perfctr-x86-core-updates	2005-02-22 18:17:35.000000000 -0800
+++ 25-akpm/arch/i386/kernel/process.c	2005-02-22 18:17:35.000000000 -0800
@@ -585,8 +585,6 @@ struct task_struct fastcall * __switch_t
 
 	/* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
 
-	perfctr_suspend_thread(prev);
-
 	__unlazy_fpu(prev_p);
 
 	/*
diff -puN include/asm-i386/system.h~perfctr-x86-core-updates include/asm-i386/system.h
--- 25/include/asm-i386/system.h~perfctr-x86-core-updates	2005-02-22 18:17:35.000000000 -0800
+++ 25-akpm/include/asm-i386/system.h	2005-02-22 18:17:35.000000000 -0800
@@ -14,6 +14,7 @@ extern struct task_struct * FASTCALL(__s
 
 #define switch_to(prev,next,last) do {					\
 	unsigned long esi,edi;						\
+	perfctr_suspend_thread(&(prev)->thread);			\
 	asm volatile("pushfl\n\t"					\
 		     "pushl %%ebp\n\t"					\
 		     "movl %%esp,%0\n\t"	/* save ESP */		\
_