Content-Type: multipart/mixed; boundary="===============6226262871430597650==" MIME-Version: 1.0 From: Johannes Weiner To: kbuild-all@lists.01.org Subject: Re: [linux-next:master 10902/11094] mm/memcontrol.c:7467:6: error: redefinition of 'obj_cgroup_may_zswap' Date: Wed, 11 May 2022 14:43:35 -0400 Message-ID: In-Reply-To: <202205120115.D6nVZNke-lkp@intel.com> List-Id: --===============6226262871430597650== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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.g= it master > head: 6107040c99d5dfc920721c198d45ed2d639b113a > commit: bf7930005b547c94d4cd312a2e0400cb8cf76d2a [10902/11094] zswap: mem= cg accounting > config: i386-randconfig-a001-20220509 (https://download.01.org/0day-ci/ar= chive/20220512/202205120115.D6nVZNke-lkp(a)intel.com/config) > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 18dd= 123c56754edf62c7042dcf23185c3727610f) > reproduce (this is a W=3D1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbi= n/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=3Dbf7930005b547c94d4cd312a2e0400cb8cf76d2a > git remote add linux-next https://git.kernel.org/pub/scm/linux/ke= rnel/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=3D$HOME/0day COMPILER=3Dclang make.cross W= =3D1 O=3Dbuild_dir ARCH=3Di386 SHELL=3D/bin/bash > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > = > 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 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 Signed-off-by: Johannes Weiner --- 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[] =3D { { "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 *me= mcg) 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 *pare= nt_css) = page_counter_set_high(&memcg->memory, PAGE_COUNTER_MAX); memcg->soft_limit =3D PAGE_COUNTER_MAX; -#ifdef CONFIG_ZSWAP +#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) memcg->zswap_max =3D PAGE_COUNTER_MAX; #endif page_counter_set_high(&memcg->swap, PAGE_COUNTER_MAX); @@ -7451,7 +7451,7 @@ static struct cftype memsw_files[] =3D { { }, /* 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[] =3D { }, { } /* 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 --===============6226262871430597650==--