Re: [PATCH 06/20] mm/slab: remove CONFIG_SLAB code from slab common code

From: Vlastimil Babka
Date: Tue Nov 14 2023 - 15:19:40 EST


On 11/14/23 05:30, Kees Cook wrote:
> On Mon, Nov 13, 2023 at 08:13:47PM +0100, Vlastimil Babka wrote:
>> In slab_common.c and slab.h headers, we can now remove all code behind
>> CONFIG_SLAB and CONFIG_DEBUG_SLAB ifdefs, and remove all CONFIG_SLUB
>> ifdefs.
>>
>> Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
>> ---
>> include/linux/slab.h | 13 +--------
>> mm/slab.h | 69 ++++----------------------------------------
>> mm/slab_common.c | 22 ++------------
>> 3 files changed, 8 insertions(+), 96 deletions(-)
>>
>> diff --git a/include/linux/slab.h b/include/linux/slab.h
>> index 34e43cddc520..90fb1f0d843a 100644
>> --- a/include/linux/slab.h
>> +++ b/include/linux/slab.h
>> @@ -24,7 +24,6 @@
>>
>> /*
>> * Flags to pass to kmem_cache_create().
>> - * The ones marked DEBUG are only valid if CONFIG_DEBUG_SLAB is set.
>
> I think this comment was wrong, yes? i.e. the "DEBUG" flags are also
> used in SLUB?

Hm yeah we could change it to CONFIG_SLUB_DEBUG. I deleted it because I
didn't think "valid" was the right word, they are always valid (part of
SLAB_FLAGS_PERMITTED thus not returning -EINVAL on cache creation), but they
would be no-op (not part of CACHE_CREATE_MASK) without CONFIG_SLUB_DEBUG.

So we coould change it to e.g.
"The ones marked DEBUG are ignored unless CONFIG_SLUB_DEBUG is enabled" ?

> Regardless:
>
> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
>