]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] ppc64: no prefetch for NULL pointers
authorOlof Johansson <olof@austin.ibm.com>
Sat, 16 Apr 2005 22:24:38 +0000 (15:24 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 16 Apr 2005 22:24:38 +0000 (15:24 -0700)
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 <olof@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-ppc64/processor.h

index eb33d33cfd6d30982afb1712134b4b5e917026c3..cae65b30adb87ec9ecdfaa9179c9e2bc26e6bca7 100644 (file)
@@ -642,11 +642,17 @@ static inline unsigned long __pack_fe01(unsigned int fpmode)
 
 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));
 }