Re: [PATCH] mm/slab.c : prefetchw the start of new allocatedobjects

From: David S. Miller
Date: Sat Jul 30 2005 - 14:33:48 EST


From: Eric Dumazet <dada1@xxxxxxxxxxxxx>
Date: Fri, 29 Jul 2005 11:05:09 +0200

> Some CPU lacks a prefetchw() and currently do nothing, so I ask this
> question : Should'nt make prefetchw() do at least a prefetch() ? A
> read hint is better than nothing.

This is not true, especially on SMP. If the only prefetch variant
available does a "prefetch for read", the cpu will only grab the
cacheline in shared state if other cpus have a dirty copy.

And, as a result, when the write to the cache line occurs yet
another bus transaction will go out in order to get exclusive
access to the cache line on the local cpu. This is extremely
inefficient.

So it's better in this case to make no prefetch, and thus only
incur one bus transaction when the memory access occurs.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/