lkml.org 
[lkml]   [2005]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[patch 054/198] ppc64: no prefetch for NULL pointers
From
Date

From: Olof Johansson <olof@austin.ibm.com>

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>
---

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

diff -puN include/asm-ppc64/processor.h~ppc64-no-prefetch-for-null-pointers include/asm-ppc64/processor.h
--- 25/include/asm-ppc64/processor.h~ppc64-no-prefetch-for-null-pointers 2005-04-12 03:21:16.364649096 -0700
+++ 25-akpm/include/asm-ppc64/processor.h 2005-04-12 03:21:16.367648640 -0700
@@ -642,11 +642,17 @@ static inline unsigned long __pack_fe01(

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 linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-04-12 22:03    [W:0.083 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site