From: Paolo 'Blaisorblade' Giarrusso Use rep_nop instead of barrier for cpu_relax, following $(SUBARCH)'s doing that (i.e. i386 and x86_64). Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton --- 25-akpm/include/asm-um/processor-generic.h | 2 -- 25-akpm/include/asm-um/processor-i386.h | 8 ++++++++ 25-akpm/include/asm-um/processor-x86_64.h | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff -puN include/asm-um/processor-generic.h~uml-cpu_relax-fix include/asm-um/processor-generic.h --- 25/include/asm-um/processor-generic.h~uml-cpu_relax-fix 2005-03-23 01:20:23.000000000 -0800 +++ 25-akpm/include/asm-um/processor-generic.h 2005-03-23 01:20:23.000000000 -0800 @@ -16,8 +16,6 @@ struct task_struct; struct mm_struct; -#define cpu_relax() barrier() - struct thread_struct { int forking; int nsyscalls; diff -puN include/asm-um/processor-i386.h~uml-cpu_relax-fix include/asm-um/processor-i386.h --- 25/include/asm-um/processor-i386.h~uml-cpu_relax-fix 2005-03-23 01:20:23.000000000 -0800 +++ 25-akpm/include/asm-um/processor-i386.h 2005-03-23 01:20:23.000000000 -0800 @@ -19,6 +19,14 @@ struct arch_thread { #include "asm/arch/user.h" +/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ +static inline void rep_nop(void) +{ + __asm__ __volatile__("rep;nop": : :"memory"); +} + +#define cpu_relax() rep_nop() + /* * Default implementation of macro that returns current * instruction pointer ("program counter"). Stolen diff -puN include/asm-um/processor-x86_64.h~uml-cpu_relax-fix include/asm-um/processor-x86_64.h --- 25/include/asm-um/processor-x86_64.h~uml-cpu_relax-fix 2005-03-23 01:20:23.000000000 -0800 +++ 25-akpm/include/asm-um/processor-x86_64.h 2005-03-23 01:20:23.000000000 -0800 @@ -12,6 +12,14 @@ struct arch_thread { }; +/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ +extern inline void rep_nop(void) +{ + __asm__ __volatile__("rep;nop": : :"memory"); +} + +#define cpu_relax() rep_nop() + #define INIT_ARCH_THREAD { } #define current_text_addr() \ _