From: Harry Yoo <harry.yoo@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Suren Baghdasaryan <surenb@google.com>,
Alexei Starovoitov <ast@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, kasan-dev@googlegroups.com
Subject: Re: [PATCH 5/5] slab: prevent recursive kmalloc() in alloc_empty_sheaf()
Date: Thu, 13 Nov 2025 13:55:52 +0900 [thread overview]
Message-ID: <aRVk2BXrC2b7RJ-V@hyeyoo> (raw)
In-Reply-To: <20251105-sheaves-cleanups-v1-5-b8218e1ac7ef@suse.cz>
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@suse.cz>
> ---
Looks good to me,
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Maybe the flag can be renamed later!
But I can't come up with a good one right now.
--
Cheers,
Harry / Hyeonggon
prev parent reply other threads:[~2025-11-13 4:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 9:05 [PATCH 0/5] slab: preparatory cleanups before adding sheaves to all caches Vlastimil Babka
2025-11-05 9:05 ` [PATCH 1/5] slab: make __slab_free() more clear Vlastimil Babka
2025-11-06 8:26 ` Harry Yoo
2025-11-06 8:43 ` Vlastimil Babka
2025-11-07 1:48 ` Harry Yoo
2025-11-05 9:05 ` [PATCH 2/5] slab: move kfence_alloc() out of internal bulk alloc Vlastimil Babka
2025-11-06 2:39 ` Alexei Starovoitov
2025-11-06 7:23 ` Vlastimil Babka
2025-11-10 8:06 ` Harry Yoo
2025-11-05 9:05 ` [PATCH 3/5] slab: handle pfmemalloc slabs properly with sheaves Vlastimil Babka
2025-11-10 9:53 ` Harry Yoo
2025-11-05 9:05 ` [PATCH 4/5] slub: remove CONFIG_SLUB_TINY specific code paths Vlastimil Babka
2025-11-13 1:52 ` Harry Yoo
2025-11-05 9:05 ` [PATCH 5/5] slab: prevent recursive kmalloc() in alloc_empty_sheaf() Vlastimil Babka
2025-11-13 4:55 ` Harry Yoo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aRVk2BXrC2b7RJ-V@hyeyoo \
--to=harry.yoo@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cl@gentwo.org \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.