On Thu, May 12, 2022 at 01:49:04AM +0800, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 6107040c99d5dfc920721c198d45ed2d639b113a > commit: bf7930005b547c94d4cd312a2e0400cb8cf76d2a [10902/11094] zswap: memcg accounting > config: i386-randconfig-a001-20220509 (https://download.01.org/0day-ci/archive/20220512/202205120115.D6nVZNke-lkp@xxxxxxxxx/config) > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 18dd123c56754edf62c7042dcf23185c3727610f) > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=bf7930005b547c94d4cd312a2e0400cb8cf76d2a > git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > git fetch --no-tags linux-next master > git checkout bf7930005b547c94d4cd312a2e0400cb8cf76d2a > # save the config file > mkdir build_dir && cp config build_dir/.config > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@xxxxxxxxx> > > All errors (new ones prefixed by >>): > > >> mm/memcontrol.c:7467:6: error: redefinition of 'obj_cgroup_may_zswap' > bool obj_cgroup_may_zswap(struct obj_cgroup *objcg) > ^ > include/linux/memcontrol.h:1816:20: note: previous definition is here > static inline bool obj_cgroup_may_zswap(struct obj_cgroup *objcg) This is a slob configuration! I'll probably NOT test this routinely in the future ;) But there is opportunity to simplify the underlying complication that caused this, which is CONFIG_MEMCG_KMEM. I need to dust off that patch and send it... For now, this delta fix addresses the problem. Runtime tested with slob and slub. --- >From f6029bc8676d990b3915b815dd6d15759ce6b1b1 Mon Sep 17 00:00:00 2001 From: Johannes Weiner <hannes@xxxxxxxxxxx> Date: Wed, 11 May 2022 14:26:59 -0400 Subject: [PATCH] zswap: memcg accounting fix Fix for CONFIG_SLOB builds: >> mm/memcontrol.c:7467:6: error: redefinition of 'obj_cgroup_may_zswap' bool obj_cgroup_may_zswap(struct obj_cgroup *objcg) ^ include/linux/memcontrol.h:1816:20: note: previous definition is here static inline bool obj_cgroup_may_zswap(struct obj_cgroup *objcg) The header file uses CONFIG_MEMCG_KMEM && CONFIG_ZSWAP to decide on implementation vs dummies; the .c file uses CONFIG_ZSWAP. SLOB builds don't have CONFIG_MEMCG_KMEM (for historical reasons). Gate everything in the code file on CONFIG_MEMCG_KMEM as well for now. Eventually, CONFIG_MEMCG_KMEM should be removed and folded into CONFIG_MEMCG. Reported-by: kernel test robot <lkp@xxxxxxxxx> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx> --- include/linux/memcontrol.h | 2 +- mm/memcontrol.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 3385ce81ecf3..b0685d01570f 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -254,7 +254,7 @@ struct mem_cgroup { /* Range enforcement for interrupt charges */ struct work_struct high_work; -#ifdef CONFIG_ZSWAP +#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) unsigned long zswap_max; #endif diff --git a/mm/memcontrol.c b/mm/memcontrol.c index cbb9b43bdb80..350012b93a95 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1398,7 +1398,7 @@ static const struct memory_stat memory_stats[] = { { "sock", MEMCG_SOCK }, { "vmalloc", MEMCG_VMALLOC }, { "shmem", NR_SHMEM }, -#ifdef CONFIG_ZSWAP +#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) { "zswap", MEMCG_ZSWAP_B }, { "zswapped", MEMCG_ZSWAPPED }, #endif @@ -1517,7 +1517,7 @@ static char *memory_stat_format(struct mem_cgroup *memcg) seq_buf_printf(&s, "%s %lu\n", vm_event_name(PGLAZYFREED), memcg_events(memcg, PGLAZYFREED)); -#ifdef CONFIG_ZSWAP +#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) seq_buf_printf(&s, "%s %lu\n", vm_event_name(ZSWPIN), memcg_events(memcg, ZSWPIN)); seq_buf_printf(&s, "%s %lu\n", vm_event_name(ZSWPOUT), @@ -5184,7 +5184,7 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) page_counter_set_high(&memcg->memory, PAGE_COUNTER_MAX); memcg->soft_limit = PAGE_COUNTER_MAX; -#ifdef CONFIG_ZSWAP +#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) memcg->zswap_max = PAGE_COUNTER_MAX; #endif page_counter_set_high(&memcg->swap, PAGE_COUNTER_MAX); @@ -7451,7 +7451,7 @@ static struct cftype memsw_files[] = { { }, /* terminate */ }; -#ifdef CONFIG_ZSWAP +#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) /** * obj_cgroup_may_zswap - check if this cgroup can zswap * @objcg: the object cgroup @@ -7582,7 +7582,7 @@ static struct cftype zswap_files[] = { }, { } /* terminate */ }; -#endif /* CONFIG_ZSWAP */ +#endif /* CONFIG_MEMCG_KMEM && CONFIG_ZSWAP */ /* * If mem_cgroup_swap_init() is implemented as a subsys_initcall() @@ -7602,7 +7602,7 @@ static int __init mem_cgroup_swap_init(void) WARN_ON(cgroup_add_dfl_cftypes(&memory_cgrp_subsys, swap_files)); WARN_ON(cgroup_add_legacy_cftypes(&memory_cgrp_subsys, memsw_files)); -#ifdef CONFIG_ZSWAP +#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) WARN_ON(cgroup_add_dfl_cftypes(&memory_cgrp_subsys, zswap_files)); #endif return 0; -- 2.35.3