[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aRVk2BXrC2b7RJ-V@hyeyoo>
Date: Thu, 13 Nov 2025 13:55:52 +0900
From: Harry Yoo <harry.yoo@...cle.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...two.org>,
David Rientjes <rientjes@...gle.com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Alexei Starovoitov <ast@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
kasan-dev@...glegroups.com
Subject: Re: [PATCH 5/5] slab: prevent recursive kmalloc() in
alloc_empty_sheaf()
On Wed, Nov 05, 2025 at 10:05:33AM +0100, Vlastimil Babka wrote:
> We want to expand usage of sheaves to all non-boot caches, including
> kmalloc caches. Since sheaves themselves are also allocated by
> kmalloc(), we need to prevent excessive or infinite recursion -
> depending on sheaf size, the sheaf can be allocated from smaller, same
> or larger kmalloc size bucket, there's no particular constraint.
>
> This is similar to allocating the objext arrays so let's just reuse the
> existing mechanisms for those. __GFP_NO_OBJ_EXT in alloc_empty_sheaf()
> will prevent a nested kmalloc() from allocating a sheaf itself - it will
> either have sheaves already, or fallback to a non-sheaf-cached
> allocation (so bootstrap of sheaves in a kmalloc cache that allocates
> sheaves from its own size bucket is possible). Additionally, reuse
> OBJCGS_CLEAR_MASK to clear unwanted gfp flags from the nested
> allocation.
>
> Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
> ---
Looks good to me,
Reviewed-by: Harry Yoo <harry.yoo@...cle.com>
Maybe the flag can be renamed later!
But I can't come up with a good one right now.
--
Cheers,
Harry / Hyeonggon
Powered by blists - more mailing lists