Skip to contentSkip to conversation

2.5.48 s390 (10/16): flushtlb bug.

PATCH New Martin Schwidefsky 1 participant 1 message Nov 18, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.48 s390 (10/16): flushtlb bug.

Don't set cpu_vm_mask if the mm isn't exclusive to the cpu.

include/asm-s390/tlbflush.h +7 -5
diff -urN linux-2.5.48/include/asm-s390/tlbflush.h linux-2.5.48-s390/include/asm-s390/tlbflush.h
@@ -91,13 +91,15 @@
 
 static inline void __flush_tlb_mm(struct mm_struct * mm)
 {
-	if (((atomic_read(&mm->mm_count) != 1) ||
-	     (mm->cpu_vm_mask != (1UL << smp_processor_id())))) {
-		mm->cpu_vm_mask = (1UL << smp_processor_id());
+	if (mm->cpu_vm_mask != (1UL << smp_processor_id())) {
+		/* mm was active on more than one cpu. */
+		if (mm == current->active_mm &&
+		    atomic_read(&mm->mm_count) == 1)
+			/* this cpu is the only one using the mm. */
+			mm->cpu_vm_mask = 1UL << smp_processor_id();
 		global_flush_tlb();
-	} else {                 
+	} else
 		local_flush_tlb();
-	}
 }
 
 static inline void flush_tlb(void)
include/asm-s390x/tlbflush.h +7 -5
diff -urN linux-2.5.48/include/asm-s390x/tlbflush.h linux-2.5.48-s390/include/asm-s390x/tlbflush.h
@@ -88,13 +88,15 @@
 
 static inline void __flush_tlb_mm(struct mm_struct * mm)
 {
-	if (((atomic_read(&mm->mm_count) != 1) ||
-	     (mm->cpu_vm_mask != (1UL << smp_processor_id())))) {
-		mm->cpu_vm_mask = (1UL << smp_processor_id());
+	if (mm->cpu_vm_mask != (1UL << smp_processor_id())) {
+		/* mm was active on more than one cpu. */
+		if (mm == current->active_mm &&
+		    atomic_read(&mm->mm_count) == 1)
+			/* this cpu is the only one using the mm. */
+			mm->cpu_vm_mask = 1UL << smp_processor_id();
 		global_flush_tlb();
-	} else {                 
+	} else
 		local_flush_tlb();
-	}
 }
 
 static inline void flush_tlb(void)