linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm, slub: prefetch freelist in ___slab_alloc()
@ 2024-08-19  7:02 Yongqiang Liu
  2024-08-19  9:33 ` Hyeonggon Yoo
  0 siblings, 1 reply; 5+ messages in thread
From: Yongqiang Liu @ 2024-08-19  7:02 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, zhangxiaoxu5, cl, wangkefeng.wang, penberg,
	rientjes, iamjoonsoo.kim, akpm, vbabka, roman.gushchin,
	42.hyeyoo

commit 0ad9500e16fe ("slub: prefetch next freelist pointer in
slab_alloc()") introduced prefetch_freepointer() for fastpath
allocation. Use it at the freelist firt load could have a bit
improvement in some workloads. Here is hackbench results at
arm64 machine(about 3.8%):

Before:
  average time cost of 'hackbench -g 100 -l 1000': 17.068

Afther:
  average time cost of 'hackbench -g 100 -l 1000': 16.416

There is also having about 5% improvement at x86_64 machine
for hackbench.

Signed-off-by: Yongqiang Liu <liuyongqiang13@huawei.com>
---
 mm/slub.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/slub.c b/mm/slub.c
index c9d8a2497fd6..f9daaff10c6a 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3630,6 +3630,7 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
 	VM_BUG_ON(!c->slab->frozen);
 	c->freelist = get_freepointer(s, freelist);
 	c->tid = next_tid(c->tid);
+	prefetch_freepointer(s, c->freelist);
 	local_unlock_irqrestore(&s->cpu_slab->lock, flags);
 	return freelist;
 
-- 
2.25.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-02 11:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-19  7:02 [PATCH] mm, slub: prefetch freelist in ___slab_alloc() Yongqiang Liu
2024-08-19  9:33 ` Hyeonggon Yoo
2024-08-21  6:58   ` Yongqiang Liu
2024-09-14 13:45     ` Hyeonggon Yoo
2024-10-02 11:57       ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox