linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Manfred Spraul" <masp0008@stud.uni-sb.de>
To: Linux MM <linux-mm@kvack.org>
Subject: [PATCH] tlb flush: further bugs? (2.3.12-9)
Date: Thu, 29 Jul 1999 13:57:23 +0200	[thread overview]
Message-ID: <002401bed9ba$16e9fb50$c80c17ac@clmsdev.local> (raw)

[-- 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)

                 reply	other threads:[~1999-07-29 11:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002401bed9ba$16e9fb50$c80c17ac@clmsdev.local' \
    --to=masp0008@stud.uni-sb.de \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox