public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Tejun Heo <tj@kernel.org>,
	"Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>,
	"Zhang, Rui" <rui.zhang@intel.com>,
	Suresh Siddha <suresh.d.siddha@intel.com>
Subject: Re: [GIT PULL] x86 fixes for 2.6.30-rc8
Date: Tue, 26 May 2009 10:33:35 -0700	[thread overview]
Message-ID: <20090526173335.GA28720@linux-os.sc.intel.com> (raw)
In-Reply-To: <4A1B23AB.7090204@zytor.com>

On Mon, May 25, 2009 at 04:03:07PM -0700, H. Peter Anvin wrote:
> Linus Torvalds wrote:
> > 
> > On Mon, 25 May 2009, Linus Torvalds wrote:
> >> Now you made it do two different "on_each_cpu" things. Maybe it doesn't 
> >> matter, but it just seems wrong.
> > 
> > Btw, I pulled, I just wanted to note that I don't think this was done 
> > optimally/cleanly.
> > 
> 
> Understood.  Do you want a fix now or for .31?
> 

Below is the patch that does this optimally.

Thanks,
Venki


[PATCH] x86: Avoid back to back on_each_cpu in cpa_flush_array

Cleanup cpa_flush_array() to avoid back to back on_each_cpu() calls.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
---
 arch/x86/mm/pageattr.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 0f9052b..532d05e 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -213,21 +213,15 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
 			    int in_flags, struct page **pages)
 {
 	unsigned int i, level;
+	unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
 
 	BUG_ON(irqs_disabled());
 
-	on_each_cpu(__cpa_flush_range, NULL, 1);
+	on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
 
-	if (!cache)
+	if (!cache || do_wbinvd)
 		return;
 
-	/* 4M threshold */
-	if (numpages >= 1024) {
-		if (boot_cpu_data.x86 >= 4)
-			on_each_cpu(wbinvd_local, NULL, 1);
-
-		return;
-	}
 	/*
 	 * We only need to flush on one CPU,
 	 * clflush is a MESI-coherent instruction that
-- 
1.6.0.6


  reply	other threads:[~2009-05-26 17:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-25 20:03 [GIT PULL] x86 fixes for 2.6.30-rc8 H. Peter Anvin
2009-05-25 22:50 ` Linus Torvalds
2009-05-25 22:51   ` Linus Torvalds
2009-05-25 23:03     ` H. Peter Anvin
2009-05-26 17:33       ` Pallipadi, Venkatesh [this message]
2009-05-25 23:02   ` H. Peter Anvin
2009-05-30 11:22 ` Pavel Machek
2009-05-30 12:13   ` Michael S. Zick
2009-05-30 19:23     ` H. Peter Anvin
2009-05-30 20:32       ` Michael S. Zick

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=20090526173335.GA28720@linux-os.sc.intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rui.zhang@intel.com \
    --cc=suresh.d.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.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