Skip to content

Commit 9aec2fb

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
slab: allocate frozen pages
Since slab does not use the page refcount, it can allocate and free frozen pages, saving one atomic operation per free. Link: https://lkml.kernel.org/r/20241125210149.2976098-16-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: William Kucharski <william.kucharski@oracle.com> Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: David Hildenbrand <david@redhat.com> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Miaohe Lin <linmiaohe@huawei.com> Cc: Muchun Song <songmuchun@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 6429752 commit 9aec2fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/slub.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,9 +2420,9 @@ static inline struct slab *alloc_slab_page(gfp_t flags, int node,
24202420
unsigned int order = oo_order(oo);
24212421

24222422
if (node == NUMA_NO_NODE)
2423-
folio = (struct folio *)alloc_pages(flags, order);
2423+
folio = (struct folio *)alloc_frozen_pages(flags, order);
24242424
else
2425-
folio = (struct folio *)__alloc_pages_node(node, flags, order);
2425+
folio = (struct folio *)__alloc_frozen_pages(flags, order, node, NULL);
24262426

24272427
if (!folio)
24282428
return NULL;
@@ -2656,7 +2656,7 @@ static void __free_slab(struct kmem_cache *s, struct slab *slab)
26562656
__folio_clear_slab(folio);
26572657
mm_account_reclaimed_pages(pages);
26582658
unaccount_slab(slab, order, s);
2659-
__free_pages(&folio->page, order);
2659+
free_frozen_pages(&folio->page, order);
26602660
}
26612661

26622662
static void rcu_free_slab(struct rcu_head *h)

0 commit comments

Comments
 (0)