mm, slab: use an enum to define SLAB_ cache creation flags
authorVlastimil Babka <vbabka@suse.cz>
Fri, 23 Feb 2024 18:27:18 +0000 (19:27 +0100)
committerVlastimil Babka <vbabka@suse.cz>
Mon, 26 Feb 2024 09:10:07 +0000 (10:10 +0100)
commitcc61eb851c9ae38546d7df6076fd883d3dbc322d
treea2103acc92def90e1de4f23de700f201e92a0bbb
parentcdeeaaba174886aa6c1ff4c0c5449c5066dbe82f
mm, slab: use an enum to define SLAB_ cache creation flags

The values of SLAB_ cache creation flags are defined by hand, which is
tedious and error-prone. Use an enum to assign the bit number and a
__SLAB_FLAG_BIT() macro to #define the final flags.

This renumbers the flag values, which is OK as they are only used
internally.

Also define a __SLAB_FLAG_UNUSED macro to assign value to flags disabled
by their respective config options in a unified and sparse-friendly way.

Reviewed-and-tested-by: Xiongwei Song <xiongwei.song@windriver.com>
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/slab.h
mm/slub.c