[patch -mm] mm: memcg: remote memcg charging for kmem allocations fix

From: David Rientjes
Date: Sun Mar 18 2018 - 16:24:59 EST


fix build warning for CONFIG_SLOB:

mm/memcontrol.c:706:27: warning: 'get_mem_cgroup' defined but not used [-Wunused-function]
static struct mem_cgroup *get_mem_cgroup(struct mem_cgroup *memcg)

Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
---
mm/memcontrol.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -701,15 +701,6 @@ struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)
return memcg;
}

-static struct mem_cgroup *get_mem_cgroup(struct mem_cgroup *memcg)
-{
- rcu_read_lock();
- if (!css_tryget_online(&memcg->css))
- memcg = NULL;
- rcu_read_unlock();
- return memcg;
-}
-
/**
* mem_cgroup_iter - iterate over memory cgroup hierarchy
* @root: hierarchy root
@@ -2128,6 +2119,15 @@ static void commit_charge(struct page *page, struct mem_cgroup *memcg,
}

#ifndef CONFIG_SLOB
+static struct mem_cgroup *get_mem_cgroup(struct mem_cgroup *memcg)
+{
+ rcu_read_lock();
+ if (!css_tryget_online(&memcg->css))
+ memcg = NULL;
+ rcu_read_unlock();
+ return memcg;
+}
+
static int memcg_alloc_cache_id(void)
{
int id, size;