[PATCH] [PPC64] No prefetch for NULL pointers

Olof Johansson olof at austin.ibm.com
Mon Apr 11 09:11:41 EST 2005

On Sun, Apr 10, 2005 at 04:03:41PM -0700, Andrew Morton wrote:

> I wonder if prefetch(0) is a common thing, or if only one or two callsites
> do it?
> If the latter then perhaps this would be better fixed at the callsites, so
> well-behaved callsites don't bear the cost of the (unneeded) test?

Actually we hit it pretty bad whenever someone is iterating over a hlist
that's short (i.e. one element). That's how the discussions started,
Serge Hallyn couldn't understand why his security patches added such
a performance penalty on ppc64: They were iterating over a policy list
that in his testcase had only one entry.

The unneeded test shouldn't be a big penalty, that's also why I added
the static prediction. Even with missing the prediction for NULL
prefetches it's better than the table walks we currently take.

So, we could either change the hlist iterators or the prefetch macro.
Since not all architectures hit this, I picked prefetch.


More information about the Linuxppc64-dev mailing list