The patch titled Subject: mm, slub: Use prefetchw instead of prefetch has been added to the -mm tree. Its filename is mm-slub-use-prefetchw-instead-of-prefetch.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-slub-use-prefetchw-instead-of-prefetch.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-slub-use-prefetchw-instead-of-prefetch.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx> Subject: mm, slub: Use prefetchw instead of prefetch It's certain that an object will be not only read, but also written after allocation. Use prefetchw instead of prefetch. On supported architectures like x86, it helps to invalidate cache line when the object exists in other processors' cache. Link: https://lkml.kernel.org/r/20211008133602.4963-1-42.hyeyoo@xxxxxxxxx Signed-off-by: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/slub.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/mm/slub.c~mm-slub-use-prefetchw-instead-of-prefetch +++ a/mm/slub.c @@ -352,9 +352,9 @@ static inline void *get_freepointer(stru return freelist_dereference(s, object + s->offset); } -static void prefetch_freepointer(const struct kmem_cache *s, void *object) +static void prefetchw_freepointer(const struct kmem_cache *s, void *object) { - prefetch(object + s->offset); + prefetchw(object + s->offset); } static inline void *get_freepointer_safe(struct kmem_cache *s, void *object) @@ -3202,10 +3202,9 @@ redo: note_cmpxchg_failure("slab_alloc", s, tid); goto redo; } - prefetch_freepointer(s, next_object); + prefetchw_freepointer(s, next_object); stat(s, ALLOC_FASTPATH); } - maybe_wipe_obj_freeptr(s, object); init = slab_want_init_on_alloc(gfpflags, s); _ Patches currently in -mm which might be from 42.hyeyoo@xxxxxxxxx are mm-slub-use-prefetchw-instead-of-prefetch.patch