[PATCH] mm/slab.c : prefetchw the start of new allocated objects

From: Eric Dumazet
Date: Fri Jul 29 2005 - 04:08:30 EST


[MM] slab.c : prefetchw the start of new allocated objects

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.

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.


Signed-off-by: Eric Dumazet <dada1@xxxxxxxxxxxxx>

diff -Nru linux-2.6.13-rc4/mm/slab.c linux-2.6.13-rc4-ed/mm/slab.c
--- linux-2.6.13-rc4/mm/slab.c 2005-07-29 00:44:44.000000000 +0200
+++ linux-2.6.13-rc4-ed/mm/slab.c 2005-07-29 10:48:45.000000000 +0200
@@ -2166,6 +2166,7 @@
}
local_irq_restore(save_flags);
objp = cache_alloc_debugcheck_after(cachep, flags, objp, __builtin_return_address(0));
+ prefetchw(objp);
return objp;
}