From: Hao Li <hao.li@linux.dev>
To: Harry Yoo <harry.yoo@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>,
Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Michal Hocko <mhocko@kernel.org>,
Yeoreum Yun <yeoreum.yun@arm.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Suren Baghdasaryan <surenb@google.com>,
linux-mm@kvack.org
Subject: Re: [PATCH V1 2/2] mm/slab: only allow SLAB_OBJ_EXT_IN_OBJ for unmergeable caches
Date: Thu, 5 Feb 2026 14:27:14 +0800 [thread overview]
Message-ID: <pjy643v7gh6migxdnmeo7bxtltlfay2pdai7lwzhyf2svk23ix@qgrtxjhutmkg> (raw)
In-Reply-To: <aYQm8_hnN9JYD0xM@hyeyoo>
On Thu, Feb 05, 2026 at 02:13:23PM +0900, Harry Yoo wrote:
> On Wed, Feb 04, 2026 at 08:45:19AM +0800, Hao Li wrote:
> > On Tue, Feb 03, 2026 at 09:32:06PM +0900, Harry Yoo wrote:
> > > On Tue, Feb 03, 2026 at 07:56:16PM +0800, Hao Li wrote:
> > > > On Tue, Jan 27, 2026 at 07:31:51PM +0900, Harry Yoo wrote:
> > > > > diff --git a/mm/slub.c b/mm/slub.c
> > > > > index ae9af184a18b..0581847e7dac 100644
> > > > > --- a/mm/slub.c
> > > > > +++ b/mm/slub.c
> > > > > @@ -7676,7 +7676,8 @@ static int calculate_sizes(struct kmem_cache_args *args, struct kmem_cache *s)
> > > > > */
> > > > > aligned_size = ALIGN(size, s->align);
> > > > > #if defined(CONFIG_SLAB_OBJ_EXT) && defined(CONFIG_64BIT)
> > > > > - if (aligned_size - size >= sizeof(struct slabobj_ext))
> > > > > + if (slab_args_unmergeable(args, s->flags) &&
> > > > > + (aligned_size - size >= sizeof(struct slabobj_ext)))
> > > > > s->flags |= SLAB_OBJ_EXT_IN_OBJ;
> > > >
> > > > Hi Harry,
> > > >
> > > > This patch looks reasonable to me. I just noticed a minor point that I
> > > > wanted to bring up:
> > > >
> > > > It seems a bit self-referential that SLAB_NEVER_MERGE already includes
> > > > SLAB_OBJ_EXT_IN_OBJ, but we're using SLAB_NEVER_MERGE to decide whether to set
> > > > SLAB_OBJ_EXT_IN_OBJ.
> > >
> > > Hi Hao, thanks for bringing it up!
> > >
> > > > Do you think it might be helpful to add a comment here for better clarity?
> > >
> > > Hmm but I'm not sure what should be clarified here.
> > > (perhaps because I wrote it).
> > >
> > > Checking SLAB_OBJ_EXT_IN_OBJ (as part of SLAB_NEVER_MERGE) before
> > > setting SLAB_OBJ_EXT_IN_OBJ should be fine (because it's not set before
> > > we set it), and once you set it, it should prevent merging.
> >
> > Yeah, s->flags currently doesn't have SLAB_OBJ_EXT_IN_OBJ, and the functionality
> > here is totally fine. I just happened to notice this while reading through the
> > code, and from a semantic perspective, it made me pause for a moment. It looks
> > like we're checking if s->flags contains SLAB_OBJ_EXT_IN_OBJ (among other flags)
> > to decide whether we can set SLAB_OBJ_EXT_IN_OBJ. Maybe we could add a small
> > comment like: "SLAB_OBJ_EXT_IN_OBJ hasn't been set yet here; this is just
> > checking for other unmergeable reasons."
> >
> > Of course, this is just a small thought, it's perfectly fine to leave it as is-I
> > just thought it might help slightly.
>
> I think it's probably okay to leave it as-is for now.
> But thanks for bringing this up!
>
Ah, no problem, thanks!
--
Thanks,
Hao
next prev parent reply other threads:[~2026-02-05 6:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 10:31 [PATCH V1 0/2] Only " Harry Yoo
2026-01-27 10:31 ` [PATCH V1 1/2] mm/slab: factor out slab_args_unmergeable() Harry Yoo
2026-01-27 16:35 ` Vlastimil Babka
2026-01-27 16:42 ` Harry Yoo
2026-01-27 16:49 ` Vlastimil Babka
2026-01-27 10:31 ` [PATCH V1 2/2] mm/slab: only allow SLAB_OBJ_EXT_IN_OBJ for unmergeable caches Harry Yoo
2026-02-03 11:56 ` Hao Li
2026-02-03 12:32 ` Harry Yoo
2026-02-04 0:45 ` Hao Li
2026-02-05 5:13 ` Harry Yoo
2026-02-05 6:27 ` Hao Li [this message]
2026-01-27 17:06 ` [PATCH V1 0/2] Only " Vlastimil Babka
2026-01-27 18:21 ` Johannes Weiner
2026-01-28 3:09 ` To enable, or not to enable slab merging? That is the question (was: Re: [PATCH V1 0/2] Only allow SLAB_OBJ_EXT_IN_OBJ for unmergeable caches) 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=pjy643v7gh6migxdnmeo7bxtltlfay2pdai7lwzhyf2svk23ix@qgrtxjhutmkg \
--to=hao.li@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=hannes@cmpxchg.org \
--cc=harry.yoo@oracle.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=yeoreum.yun@arm.com \
/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