From a9ac8afaedff5f48052afdf52cfea4fd3541d26e Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Wed, 3 Jul 2013 15:00:13 +0200 Subject: [PATCH] memcg: fix build error if CONFIG_MEMCG_KMEM=n Fix this build error: mm/built-in.o: In function `mem_cgroup_css_free': memcontrol.c:(.text+0x5caa6): undefined reference to 'mem_cgroup_sockets_destroy' Maybe it's better to add memcg_destroy_kmem(), to pair with memcg_init_kmem(). This patch can be folded into "memcg: use css_get/put when charging/uncharging kmem". Rename the patch as it is a follow-up for the mmotm tree: "memcg-use-css_get-put-when-charging-uncharging-kmem-fix-2.patch" See [1] for the original patch and follow the discussion in [2]. [1] http://marc.info/?l=linux-mm&m=137285590123430&w=2 [2] http://marc.info/?t=137285378500005&r=1&w=2 Reported-by: Fengguang Wu Reported-by: Stephen Rothwell Reported-by: Sedat Dilek Tested-by: Sedat Dilek Acked-by: Michal Hocko Signed-off-by: Li Zefan --- [ dileks: * Add comments from Li Zefan * Add suggestion for new patch-name from Michal * Add references to orig-patch and discussion ] mm/memcontrol.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d6a3e56..00a7a66 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5896,6 +5896,11 @@ static int memcg_init_kmem(struct mem_cgroup *memcg, struct cgroup_subsys *ss) return mem_cgroup_sockets_init(memcg, ss); } +static void memcg_destroy_kmem(struct mem_cgroup *memcg) +{ + mem_cgroup_sockets_destroy(memcg); +} + static void kmem_cgroup_css_offline(struct mem_cgroup *memcg) { if (!memcg_kmem_is_active(memcg)) @@ -5935,6 +5940,10 @@ static int memcg_init_kmem(struct mem_cgroup *memcg, struct cgroup_subsys *ss) return 0; } +static void memcg_destroy_kmem(struct mem_cgroup *memcg) +{ +} + static void kmem_cgroup_css_offline(struct mem_cgroup *memcg) { } @@ -6332,8 +6341,7 @@ static void mem_cgroup_css_free(struct cgroup *cont) { struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); - mem_cgroup_sockets_destroy(memcg); - + memcg_destroy_kmem(memcg); __mem_cgroup_free(memcg); } -- 1.8.3.2