From: Anton Blanchard <anton@samba.org>

This appeared in the ia64 port and sounds like a good idea. Potentially
avoid an atomic operation in switch_mm.


---

 include/asm-ppc64/mmu_context.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN include/asm-ppc64/mmu_context.h~ppc64-flushfix include/asm-ppc64/mmu_context.h
--- 25/include/asm-ppc64/mmu_context.h~ppc64-flushfix	2004-02-21 20:58:14.000000000 -0800
+++ 25-akpm/include/asm-ppc64/mmu_context.h	2004-02-21 20:58:14.000000000 -0800
@@ -156,6 +156,9 @@ static inline void switch_mm(struct mm_s
 	 : : );
 #endif /* CONFIG_ALTIVEC */
 
+	if (!cpu_isset(smp_processor_id(), next->cpu_vm_mask))
+		cpu_set(smp_processor_id(), next->cpu_vm_mask);
+
 	/* No need to flush userspace segments if the mm doesnt change */
 	if (prev == next)
 		return;
@@ -164,7 +167,6 @@ static inline void switch_mm(struct mm_s
 		flush_slb(tsk, next);
 	else
 		flush_stab(tsk, next);
-	cpu_set(smp_processor_id(), next->cpu_vm_mask);
 }
 
 #define deactivate_mm(tsk,mm)	do { } while (0)

_