mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Avoid double flush in do_tlb_flush_all()
Date: Sat, 30 Aug 2008 12:20:12 +0200	[thread overview]
Message-ID: <20080830102012.GA21145@basil.nowhere.org> (raw)

Avoid double flush in do_tlb_flush_all()

leave_mm already flushes the TLBs, so don't need to flush directly before that
in do_flush_tlb_all(). Avoid the double flush.

Pointed out by Rainer Weikusat

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 arch/x86/kernel/tlb_32.c |    5 ++---
 arch/x86/kernel/tlb_64.c |    7 +++----
 2 files changed, 5 insertions(+), 7 deletions(-)

Index: linux-2.6.27-rc4-misc/arch/x86/kernel/tlb_32.c
===================================================================
--- linux-2.6.27-rc4-misc.orig/arch/x86/kernel/tlb_32.c
+++ linux-2.6.27-rc4-misc/arch/x86/kernel/tlb_32.c
@@ -229,11 +229,10 @@ EXPORT_SYMBOL(flush_tlb_page);
 
 static void do_flush_tlb_all(void *info)
 {
-	unsigned long cpu = smp_processor_id();
-
-	__flush_tlb_all();
 	if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_LAZY)
 		leave_mm(cpu);
+	else
+		__flush_tlb_all(smp_processor_id());
 }
 
 void flush_tlb_all(void)
Index: linux-2.6.27-rc4-misc/arch/x86/kernel/tlb_64.c
===================================================================
--- linux-2.6.27-rc4-misc.orig/arch/x86/kernel/tlb_64.c
+++ linux-2.6.27-rc4-misc/arch/x86/kernel/tlb_64.c
@@ -266,11 +266,10 @@ void flush_tlb_page(struct vm_area_struc
 
 static void do_flush_tlb_all(void *info)
 {
-	unsigned long cpu = smp_processor_id();
-
-	__flush_tlb_all();
 	if (read_pda(mmu_state) == TLBSTATE_LAZY)
-		leave_mm(cpu);
+		leave_mm(smp_processor_id());
+	else
+		__flush_tlb_all();
 }
 
 void flush_tlb_all(void)

             reply	other threads:[~2008-08-30 10:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-30 10:20 Andi Kleen [this message]
2008-08-30 16:01 ` Arjan van de Ven

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=20080830102012.GA21145@basil.nowhere.org \
    --to=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®