Messages in this thread Patch in this message | | | Date | Tue, 26 May 2009 10:33:35 -0700 | From | "Pallipadi, Venkatesh" <> | Subject | Re: [GIT PULL] x86 fixes for 2.6.30-rc8 |
| |
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
| |