Re: [PATCH v3 13/15] mm/slab: introduce kmalloc_flags()
From: Harry Yoo
Date: Wed Jun 17 2026 - 07:37:38 EST
On 6/15/26 8:54 PM, Vlastimil Babka (SUSE) wrote:
> With alloc_flags usage in slab, we can replace __GFP_NO_OBJ_EXT with an
> alloc flag that prevents kmalloc recursion. For that we need a version
> of kmalloc() that takes alloc_flags and use it in places that perform
> these potentially recursive kmalloc allocations (of sheaves or obj_ext
> arrays).
>
> Add this function, named kmalloc_flags(). Right now it's only useful for
> these nested allocations, so it doesn't need to optimize build-time
> constant sizes like kmalloc() or kmalloc_buckets.
>
> Since we need it to support both normal and non-spinning
> kmalloc_nolock() context through the SLAB_ALLOC_NOLOCK flag, split out
> most of the special _kmalloc_nolock_noprof() implementation to
> __kmalloc_nolock_noprof() that takes a slab_alloc_context, and make
> _kmalloc_nolock_noprof() a simple tail calling wrapper with the proper
> context.
>
> kmalloc_flags() can thus determine whether to call
> __kmalloc_nolock_noprof() or __do_kmalloc_node(), based on the
> given alloc_flags.
>
> Link: https://patch.msgid.link/20260610-slab_alloc_flags-v2-14-7190909db118@xxxxxxxxxx
> Reviewed-by: Hao Li <hao.li@xxxxxxxxx>
> Reviewed-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>
> ---
Looks good to me,
Reviewed-by: Harry Yoo (Oracle) <harry@xxxxxxxxxx>
--
Cheers,
Harry / Hyeonggon
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature