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

From: Andrew Morton
Date: Fri Jul 29 2005 - 04:21:29 EST

Eric Dumazet <dada1@xxxxxxxxxxxxx> wrote:
> Most of objects returned by __cache_alloc() will be written by the caller,
> (but not all callers want to write all the object, but just at the begining)
> prefetchw() tells the modern CPU to think about the future writes, ie start
> some memory transactions in advance.

Sounds sensible enough.. slab does try to make sure it returns the
most-recently-freed object, so it's probably in cache already. But in the
situation where we're allocating and using a lot of objects in succession
it might help.

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

Don't think so. I was once told that if the cacheline is in local cache
for reading and the CPU decides to write to it, additional work is needed
for the write so the prefetch-for-read didn't buy you anything.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at