Re: [PATCH] mm, slub: Use prefetchw instead of prefetch

From: Hyeonggon Yoo
Date: Mon Oct 11 2021 - 03:32:47 EST


On Mon, Oct 11, 2021 at 09:20:36AM +0200, Christoph Lameter wrote:
> On Fri, 8 Oct 2021, Hyeonggon Yoo wrote:
>
> > It's certain that an object will be not only read, but also
> > written after allocation.
>
> get_freepointer is used in multiple code path not only in allocation. It
> is for example used when scanning through a freelist.
>
> With this change all objects get needlessly dirtied and the cross cpu
> cache contention is increased.

I didn't touch get_freepointer and there's
only one caller of prefetch_freepointer.

My change was not adding additional prefetch on get_freepointer,
but changing existing prefetch into prefetchw.

The prefetch was introcued by commit 0ad9500e16fe ("slub: prefetch next
freelist pointer in slab_alloc()") that you ACKed in 2011.

Do you think removeing existing prefetch is better than changing it
from prefetch to prefetchw?