Re: [PATCH v4 04/22] mm/slab: move and refactor __kmem_cache_alias()

From: Vlastimil Babka

Date: Tue Jan 27 2026 - 11:59:38 EST


On 1/27/26 17:17, Liam R. Howlett wrote:
> * Vlastimil Babka <vbabka@xxxxxxx> [260123 01:53]:
>> Move __kmem_cache_alias() to slab_common.c since it's called by
>> __kmem_cache_create_args() and calls find_mergeable() that both
>> are in this file. We can remove two slab.h declarations and make
>> them static. Instead declare sysfs_slab_alias() from slub.c so
>> that __kmem_cache_alias() can keep calling it.
>>
>> Add args parameter to __kmem_cache_alias() and find_mergeable() instead
>> of align and ctor. With that we can also move the checks for usersize
>> and sheaf_capacity there from __kmem_cache_create_args() and make the
>> result more symmetric with slab_unmergeable().
>>
>> No functional changes intended.
>>
>> Reviewed-by: Harry Yoo <harry.yoo@xxxxxxxxxx>
>> Reviewed-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
>> Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
>
> One nit.
>
> Reviewed-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>

Thanks.

>> ---
>> mm/slab.h | 8 +++-----
>> mm/slab_common.c | 44 +++++++++++++++++++++++++++++++++++++-------
>> mm/slub.c | 30 +-----------------------------
>> 3 files changed, 41 insertions(+), 41 deletions(-)
>>
>> diff --git a/mm/slab.h b/mm/slab.h
>> index e767aa7e91b0..cb48ce5014ba 100644
>> --- a/mm/slab.h
>> +++ b/mm/slab.h
>> @@ -281,9 +281,12 @@ struct kmem_cache {
>> #define SLAB_SUPPORTS_SYSFS 1
>> void sysfs_slab_unlink(struct kmem_cache *s);
>> void sysfs_slab_release(struct kmem_cache *s);
>> +int sysfs_slab_alias(struct kmem_cache *, const char *);
>
> nit: the names of the variables are missing. I guess because they were
> missing before. *s and *name, I guess, although they are *s and *p
> in the other declaration.

Yeah will change both to s and name, thanks.