Skip to content

Commit

Permalink
[PATCH] ppc64: no prefetch for NULL pointers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Olof Johansson authored and Linus Torvalds committed Apr 16, 2005
1 parent 89e09f5 commit e63f8f4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/asm-ppc64/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit e63f8f4

Please sign in to comment.