[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0703071453080.5963@woody.linux-foundation.org>
Date: Wed, 7 Mar 2007 14:57:27 -0800 (PST)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Anton Blanchard <anton@...ba.org>
cc: Eric Dumazet <dada1@...mosbay.com>,
Davide Libenzi <davidel@...ilserver.org>,
Avi Kivity <avi@...o.co.il>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [patch] epoll use a single inode ...
On Wed, 7 Mar 2007, Anton Blanchard wrote:
>
> Funny you mention this. We found some noticeable ppc64 regressions when
> moving the dcache to standard list macros and had to do this to fix it
> up:
>
> static inline void prefetch(const void *x)
> {
> if (unlikely(!x))
> return;
>
> __asm__ __volatile__ ("dcbt 0,%0" : : "r" (x));
> }
>
> Urgh :)
Yeah, I'm not at all surprised. Any implementation of "prefetch" that
doesn't just turn into a no-op if the TLB entry doesn't exist (which makes
them weaker for *actual* prefetching) will generally have a hard time with
a NULL pointer. Exactly because it will try to do a totally unnecessary
TLB fill - and since most CPU's will not cache negative TLB entries, that
unnecessary TLB fill will be done over and over and over again..
In general, using software prefetching is just a stupid idea, unless
- the prefetch really is very strict (ie for a linked list you do exactly
the above kinds of things to make sure that you don't try to prefetch
the non-existent end entry)
AND
- the CPU is stupid (in-order in particular).
I think Intel even suggests in their optimization manuals to *not* do
software prefetching, because hw can usually simply do better without it.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists