From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Sang-Heon Jeon <ekffu200098@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Harry Yoo <harry@kernel.org>
Cc: Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>, Hao Li <hao.li@linux.dev>,
linux-mm@kvack.org, Roman Gushchin <roman.gushchin@linux.dev>
Subject: Re: [PATCH v2] mm/slub: clamp slab_min_order to MAX_PAGE_ORDER
Date: Mon, 12 Oct 2026 10:23:16 +0200 [thread overview]
Message-ID: <5895ceec-df6a-4604-a7b9-8138212d786f@kernel.org> (raw)
In-Reply-To: <20261011014841.405327-1-ekffu200098@gmail.com>
On 10/11/26 03:48, Sang-Heon Jeon wrote:
> setup_slub_max_order() clamps slab_max_order to MAX_PAGE_ORDER, but
> setup_slub_min_order() has no such clamp.
>
> The buddy allocator cannot allocate more than 2^MAX_PAGE_ORDER pages
> at once, so slab_min_order above it makes no sense.
>
> If slab_min_order is set above MAX_PAGE_ORDER, it can even panic at
> boot or invoke undefined behavior in order_objects().
>
> So clamp slab_min_order to MAX_PAGE_ORDER as well.
>
> Fixes: 81819f0fc828 ("SLUB core")
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Hi,
this is effectively part of my bigger refactor here:
https://lore.kernel.org/linux-mm/20260923-slub_tiny_rework-v1-1-a0e66d536eb5@kernel.org/
Thanks,
Vlastimil
> ---
> Changes from v1 [1]
> - Change fixes tag to 81819f0fc828 ("SLUB core")
> - Remove stable tag
>
> [1] https://lore.kernel.org/all/20261007163403.1643768-1-ekffu200098@gmail.com/#t
> ---
> mm/slub.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 1559cbace469..8400df7c222e 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -8354,6 +8354,8 @@ static int __init setup_slub_min_order(const char *str, const struct kernel_para
> if (ret)
> return ret;
>
> + slub_min_order = min_t(unsigned int, slub_min_order, MAX_PAGE_ORDER);
> +
> if (slub_min_order > slub_max_order)
> slub_max_order = slub_min_order;
>
>
> base-commit: d755441b7672c74f29d1241ffdd2b067ecab1ca0
next prev parent reply other threads:[~2026-10-12 8:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 1:48 [PATCH v2] mm/slub: clamp slab_min_order to MAX_PAGE_ORDER Sang-Heon Jeon
2026-10-12 8:23 ` Vlastimil Babka (SUSE) [this message]
2026-10-12 13:21 ` Sang-Heon Jeon
2026-10-12 14:09 ` Harry Yoo
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=5895ceec-df6a-4604-a7b9-8138212d786f@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=ekffu200098@gmail.com \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).