tree eb80efbfb8e4c55a94610d30fb8424cd128ffe8b
parent 89e09f5ebba4bcde9852e4be4af536d5b691f20a
author Olof Johansson <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:24:38 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:24:38 -0700

[PATCH] ppc64: no prefetch for NULL pointers

For prefetches of NULL (as when walking a short linked list), PPC64 will in
some cases take a performance hit.  The hardware needs to do the TLB walk,
and said walk will always miss, which means (up to) two L2 misses as
penalty.  This seems to hurt overall performance, so for NULL pointers skip
the prefetch alltogether.

Signed-off-by: Olof Johansson <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 asm-ppc64/processor.h |    6 ++++++
 1 files changed, 6 insertions(+)

Index: include/asm-ppc64/processor.h
===================================================================
--- 3098bc3e95322f2f9050daa539f772fdb7d7b04b/include/asm-ppc64/processor.h  
(mode:100644 sha1:eb33d33cfd6d30982afb1712134b4b5e917026c3)
+++ eb80efbfb8e4c55a94610d30fb8424cd128ffe8b/include/asm-ppc64/processor.h  
(mode:100644 sha1:cae65b30adb87ec9ecdfaa9179c9e2bc26e6bca7)
@@ -642,11 +642,17 @@
 
 static inline void prefetch(const void *x)
 {
+       if (unlikely(!x))
+               return;
+
        __asm__ __volatile__ ("dcbt 0,%0" : : "r" (x));
 }
 
 static inline void prefetchw(const void *x)
 {
+       if (unlikely(!x))
+               return;
+
        __asm__ __volatile__ ("dcbtst 0,%0" : : "r" (x));
 }
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to