[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQ1P8mHnv6_FE7Fh@harry>
Date: Fri, 7 Nov 2025 10:48:34 +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 1/5] slab: make __slab_free() more clear
On Thu, Nov 06, 2025 at 09:43:24AM +0100, Vlastimil Babka wrote:
> On 11/6/25 09:26, Harry Yoo wrote:
> > On Wed, Nov 05, 2025 at 10:05:29AM +0100, Vlastimil Babka wrote:
> >> The function is tricky and many of its tests are hard to understand. Try
> >> to improve that by using more descriptively named variables and added
> >> comments.
> >>
> >> - rename 'prior' to 'old_head' to match the head and tail parameters
> >> - introduce a 'bool was_full' to make it more obvious what we are
> >> testing instead of the !prior and prior tests
> >
> > Yeah I recall these were cryptic when I was analyzing slab few years
> > ago :)
> >
> >> - add or improve comments in various places to explain what we're doing
> >>
> >> Also replace kmem_cache_has_cpu_partial() tests with
> >> IS_ENABLED(CONFIG_SLUB_CPU_PARTIAL) which are compile-time constants.
> >>
> >> We can do that because the kmem_cache_debug(s) case is handled upfront
> >> via free_to_partial_list().
> >
> > This makes sense. By the way, should we also check IS_ENABLED(CONFIG_SLUB_TINY)
> > in kmem_cache_has_cpu_partial()?
>
> If you really mean testing CONFIG_SLUB_TINY then it's not necessary because
> CONFIG_SLUB_CPU_PARTIAL depends on !TINY.
I really meant this and yeah I missed that!
> If you mean using IS_ENABLED(CONFIG_SLUB_CPU_PARTIAL) instead of the #ifdef,
> that could be possible, just out of scope here. And hopefully will be gone
> fully, so no point in polishing at this point. Unlike __slab_free() which stays.
Agreed.
> >> Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
> >> ---
> >
> > The code is much cleaner!
> >
> > Reviewed-by: Harry Yoo <harry.yoo@...cle.com>
--
Cheers,
Harry / Hyeonggon
Powered by blists - more mailing lists