patch-2.4.22 linux-2.4.22/include/asm-sh/mmu_context.h

Next file: linux-2.4.22/include/asm-sh/mmzone.h
Previous file: linux-2.4.22/include/asm-sh/mc146818rtc.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/include/asm-sh/mmu_context.h linux-2.4.22/include/asm-sh/mmu_context.h
@@ -29,19 +29,32 @@
  */
 #define MMU_VPN_MASK	0xfffff000
 
+/*
+ * Get MMU context if needed.
+ */
 static __inline__ void
-get_new_mmu_context(struct mm_struct *mm)
+get_mmu_context(struct mm_struct *mm)
 {
 	extern void flush_tlb_all(void);
+	unsigned long mc = mmu_context_cache;
 
-	unsigned long mc = ++mmu_context_cache;
+	/* Check if we have old version of context. */
+	if (((mm->context ^ mc) & MMU_CONTEXT_VERSION_MASK) == 0)
+		/* It's up to date, do nothing */
+		return;
 
+	/* It's old, we need to get new context with new version. */
+	mc = ++mmu_context_cache;
 	if (!(mc & MMU_CONTEXT_ASID_MASK)) {
-		/* We exhaust ASID of this version.
-		   Flush all TLB and start new cycle. */
+		/*
+		 * We exhaust ASID of this version.
+		 * Flush all TLB and start new cycle.
+		 */
 		flush_tlb_all();
-		/* Fix version if needed.
-		   Note that we avoid version #0 to distingush NO_CONTEXT. */
+		/*
+		 * Fix version; Note that we avoid version #0
+		 * to distingush NO_CONTEXT.
+		 */
 		if (!mc)
 			mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION;
 	}
@@ -49,21 +62,6 @@
 }
 
 /*
- * Get MMU context if needed.
- */
-static __inline__ void
-get_mmu_context(struct mm_struct *mm)
-{
-	if (mm) {
-		unsigned long mc = mmu_context_cache;
-		/* Check if we have old version of context.
-		   If it's old, we need to get new context with new version. */
-		if ((mm->context ^ mc) & MMU_CONTEXT_VERSION_MASK)
-			get_new_mmu_context(mm);
-	}
-}
-
-/*
  * Initialize the context related info for a new mm_struct
  * instance.
  */
@@ -169,8 +167,6 @@
 	if (prev != next) {
 		unsigned long __pgdir = (unsigned long)next->pgd;
 
-		clear_bit(cpu, &prev->cpu_vm_mask);
-		set_bit(cpu, &next->cpu_vm_mask);
 		__asm__ __volatile__("mov.l	%0, %1"
 				     : /* no output */
 				     : "r" (__pgdir), "m" (__m(MMU_TTB)));
@@ -185,4 +181,5 @@
 enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
 {
 }
+
 #endif /* __ASM_SH_MMU_CONTEXT_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)