public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Use clflush() instead of wbinvd() whenever possible when changing mapping
@ 2009-07-24  7:53 Thomas Hellstrom
  2009-07-24 10:05 ` Andi Kleen
  2009-07-30  9:07 ` Pavel Machek
  0 siblings, 2 replies; 8+ messages in thread
From: Thomas Hellstrom @ 2009-07-24  7:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, venkatesh.pallipadi, Thomas Hellstrom

The current code uses wbinvd() when the area to flush is > 4MB. Although this
may be faster than using clflush() the effect of wbinvd() on irq latencies
may be catastrophical on systems with large caches. Therefore use clflush()
whenever possible and accept the slight performance hit.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
 arch/x86/mm/pageattr.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 1b734d7..d4327db 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -209,13 +209,12 @@ 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_all, (void *) do_wbinvd, 1);
+	on_each_cpu(__cpa_flush_all, (void *) 0UL, 1);
 
-	if (!cache || do_wbinvd)
+	if (!cache)
 		return;
 
 	/*
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-08-02 16:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-24  7:53 [PATCH] x86: Use clflush() instead of wbinvd() whenever possible when changing mapping Thomas Hellstrom
2009-07-24 10:05 ` Andi Kleen
2009-07-24 10:21   ` Thomas Hellstrom
2009-07-24 10:58     ` Andi Kleen
2009-07-24 11:14       ` Thomas Hellstrom
2009-07-24 13:16         ` Andi Kleen
2009-07-30  9:07 ` Pavel Machek
2009-08-02 16:22   ` Thomas Hellström

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