linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tlb flush: further bugs? (2.3.12-9)
@ 1999-07-29 11:57 Manfred Spraul
  0 siblings, 0 replies; only message in thread
From: Manfred Spraul @ 1999-07-29 11:57 UTC (permalink / raw)
  To: Linux MM

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]

I think I found 2 minor bugs in the current tlb flush code:
- during crossing TLB flushes, mm->cpu_mask is not set.
- flush_tlb_current_task() contains a race between
flush_tlb_other_cpus(the IPI could set mm->cpu_mask)
& the next line.
effectively, my patch means that flush_tlb_current_task() 
is identical to flush_tlb_mm(current->mm), perhaps this should
be replaced with a #define.

I've attached a patch (untested) against 2.3.12-9,

    Manfred


[-- Attachment #2: smp.c.diff --]
[-- Type: application/octet-stream, Size: 988 bytes --]

--- smp.c.old	Thu Jul 29 13:06:18 1999
+++ SMP.C	Thu Jul 29 13:55:41 1999
@@ -1617,6 +1617,8 @@
 			if (test_bit(cpu, &smp_invalidate_needed)) {
 				clear_bit(cpu, &smp_invalidate_needed);
 				local_flush_tlb();
+                                if(current->mm)
+                                        atomic_set_mask(1 << cpu, &current->mm->cpu_vm_mask);
 			}
 			--stuck;
 			if (!stuck) {
@@ -1637,14 +1639,16 @@
  */	
 void flush_tlb_current_task(void)
 {
-	unsigned long vm_mask = 1 << current->processor;
 	struct mm_struct *mm = current->mm;
+	unsigned long vm_mask = 1 << current->processor;
+	unsigned long cpu_mask = mm->cpu_vm_mask & ~vm_mask;
 
-	if (mm->cpu_vm_mask != vm_mask) {
-		flush_tlb_others(mm->cpu_vm_mask & ~vm_mask);
+	mm->cpu_vm_mask = 0;
+	if (current->active_mm == mm) {
 		mm->cpu_vm_mask = vm_mask;
+		local_flush_tlb();
 	}
-	local_flush_tlb();
+	flush_tlb_others(cpu_mask);
 }
 
 void flush_tlb_mm(struct mm_struct * mm)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-07-29 11:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-29 11:57 [PATCH] tlb flush: further bugs? (2.3.12-9) Manfred Spraul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox