linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: Tejun Heo <tj@kernel.org>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>,
	penberg@kernel.org,  David Rientjes <rientjes@google.com>,
	iamjoonsoo.kim@lge.com,  Cgroups <cgroups@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH] mm, memcg: fix build error around the usage of kmem_caches
Date: Thu, 6 Feb 2020 09:15:47 +0800	[thread overview]
Message-ID: <CALOAHbDaHifzkf8ZVBdNr60hkuke8aapsHwh8Fb9+BPJ5M==Uw@mail.gmail.com> (raw)
In-Reply-To: <1ef8ee2e-0f50-fcd6-ae13-d6524fcf9764@redhat.com>

On Thu, Feb 6, 2020 at 1:19 AM David Hildenbrand <david@redhat.com> wrote:
>
> On 05.02.20 18:03, Yafang Shao wrote:
> > When I manually set default n to MEMCG_KMEM in init/Kconfig, bellow error
> > occurs,
> >
> > mm/slab_common.c: In function 'memcg_slab_start':
> > mm/slab_common.c:1530:30: error: 'struct mem_cgroup' has no member named
> > 'kmem_caches'
> >   return seq_list_start(&memcg->kmem_caches, *pos);
> >                               ^
> > mm/slab_common.c: In function 'memcg_slab_next':
> > mm/slab_common.c:1537:32: error: 'struct mem_cgroup' has no member named
> > 'kmem_caches'
> >   return seq_list_next(p, &memcg->kmem_caches, pos);
> >                                 ^
> > mm/slab_common.c: In function 'memcg_slab_show':
> > mm/slab_common.c:1551:16: error: 'struct mem_cgroup' has no member named
> > 'kmem_caches'
> >   if (p == memcg->kmem_caches.next)
> >                 ^
> >   CC      arch/x86/xen/smp.o
> > mm/slab_common.c: In function 'memcg_slab_start':
> > mm/slab_common.c:1531:1: warning: control reaches end of non-void function
> > [-Wreturn-type]
> >  }
> >  ^
> > mm/slab_common.c: In function 'memcg_slab_next':
> > mm/slab_common.c:1538:1: warning: control reaches end of non-void function
> > [-Wreturn-type]
> >  }
> >  ^
> >
> > That's because kmem_caches is defined only when CONFIG_MEMCG_KMEM is set,
> > while memcg_slab_start() will use it no matter CONFIG_MEMCG_KMEM is defined
> > or not.
> >
> > By the way, the reason I mannuly undefined CONFIG_MEMCG_KMEM is to verify
> > whether my some other code change is still stable when CONFIG_MEMCG_KMEM is
> > not set. Unfortunately, the existing code has been already unstable since
> > v4.11.
> >
> > Fixes: bc2791f857e1 ("slab: link memcg kmem_caches on their associated memory cgroup")
> > Cc: Tejun Heo <tj@kernel.org>
> > Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
> > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > ---
> >  mm/memcontrol.c  | 2 ++
> >  mm/slab_common.c | 2 +-
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 6f6dc8712e39..43f0125b45bb 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -4723,6 +4723,7 @@ static struct cftype mem_cgroup_legacy_files[] = {
> >               .write = mem_cgroup_reset,
> >               .read_u64 = mem_cgroup_read_u64,
> >       },
> > +#ifdef CONFIG_MEMCG_KMEM
> >  #if defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG)
>
> Not sure if
>
> #if defined(CONFIG_MEMCG_KMEM) && \
>     (defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG))
>
> is preffered
>

Seems better. Thanks for your suggestion.

Thanks
Yafang


      reply	other threads:[~2020-02-06  1:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 17:03 Yafang Shao
2020-02-05 17:18 ` David Hildenbrand
2020-02-06  1:15   ` Yafang Shao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALOAHbDaHifzkf8ZVBdNr60hkuke8aapsHwh8Fb9+BPJ5M==Uw@mail.gmail.com' \
    --to=laoar.shao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=cl@linux.com \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=tj@kernel.org \
    --cc=vdavydov.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox