Re: [PATCH 4/4] mm/slab: move slab merge from slab_common.c to slub.c

From: Hyeonggon Yoo
Date: Tue Nov 21 2023 - 04:02:15 EST


On Mon, Nov 20, 2023 at 6:13 PM <sxwjean@xxxxxx> wrote:
>
> From: Xiongwei Song <xiongwei.song@xxxxxxxxxxxxx>
>
> Since slab allocator has been removed. There is no users about slab
> merge except slub. This commit is almost to revert
> commit 423c929cbbec ("mm/slab_common: commonize slab merge logic").
>
> Also change all prefix of slab merge related functions, variables and
> definitions from "slab/SLAB" to"slub/SLUB".
>
> Signed-off-by: Xiongwei Song <xiongwei.song@xxxxxxxxxxxxx>
> ---
> mm/slab.h | 3 --
> mm/slab_common.c | 98 ----------------------------------------------
> mm/slub.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 99 insertions(+), 102 deletions(-)
[...]
> +/*
> + * Merge control. If this is set then no merging of slab caches will occur.
> + */
> +static bool slub_nomerge = !IS_ENABLED(CONFIG_SLAB_MERGE_DEFAULT);
> +
> +static int __init setup_slub_nomerge(char *str)
> +{
> + slub_nomerge = true;
> + return 1;
> +}
> +
> +static int __init setup_slub_merge(char *str)
> +{
> + slub_nomerge = false;
> + return 1;
> +}
> +
> +__setup_param("slub_nomerge", slub_nomerge, setup_slab_nomerge, 0);
> +__setup_param("slub_merge", slub_merge, setup_slab_merge, 0);

FYI This hunk breaks kernel builds:

In file included from ./include/linux/printk.h:6,
from ./include/asm-generic/bug.h:22,
from ./arch/x86/include/asm/bug.h:87,
from ./include/linux/bug.h:5,
from ./include/linux/mmdebug.h:5,
from ./include/linux/mm.h:6,
from mm/slub.c:13:
mm/slub.c:748:45: error: ‘setup_slab_nomerge’ undeclared here (not in
a function); did you mean ‘setup_slub_nomerge’?
748 | __setup_param("slub_nomerge", slub_nomerge, setup_slab_nomerge, 0);
| ^~~~~~~~~~~~~~~~~~
./include/linux/init.h:340:32: note: in definition of macro ‘__setup_param’
340 | = { __setup_str_##unique_id, fn, early }
| ^~
mm/slub.c:749:41: error: ‘setup_slab_merge’ undeclared here (not in a
function); did you mean ‘setup_slub_merge’?
749 | __setup_param("slub_merge", slub_merge, setup_slab_merge, 0);
| ^~~~~~~~~~~~~~~~
./include/linux/init.h:340:32: note: in definition of macro ‘__setup_param’
340 | = { __setup_str_##unique_id, fn, early }
| ^~
CC kernel/time/ntp.o
mm/slub.c:742:19: warning: ‘setup_slub_merge’ defined but not used
[-Wunused-function]
742 | static int __init setup_slub_merge(char *str)
| ^~~~~~~~~~~~~~~~
mm/slub.c:736:19: warning: ‘setup_slub_nomerge’ defined but not used
[-Wunused-function]
736 | static int __init setup_slub_nomerge(char *str)
| ^~~~~~~~~~~~~~~~~~