[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a1922c8a-6cd1-4d79-8a7a-7462a1e791f5@suse.cz>
Date: Thu, 6 Nov 2025 09:43:24 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Harry Yoo <harry.yoo@...cle.com>
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 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.
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.
>> Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
>> ---
>
> The code is much cleaner!
>
> Reviewed-by: Harry Yoo <harry.yoo@...cle.com>
>
Powered by blists - more mailing lists