[PATCH] mm: guard kmemcg_queue_cache_shutdown() with CONFIG_MEMCG_KMEM

From: Roman Gushchin
Date: Mon May 20 2019 - 13:52:07 EST


Currently kmemcg_queue_cache_shutdown() is defined only
if CONFIG_MEMCG_KMEM is set, however the declaration is not guarded
with corresponding ifdefs. So a compilation warning might be produced.

Let's move the declaration to the section of slab_common.c, where all
kmemcg-specific stuff is defined.

Reported-by: Waiman Long <longman9394@xxxxxxxxx>
Signed-off-by: Roman Gushchin <guro@xxxxxx>
---
mm/slab_common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index 9d2a3d6245dc..e818609c8209 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -45,8 +45,6 @@ static void slab_caches_to_rcu_destroy_workfn(struct work=
_struct *work);
static DECLARE_WORK(slab_caches_to_rcu_destroy_work,
slab_caches_to_rcu_destroy_workfn);
=20
-static void kmemcg_queue_cache_shutdown(struct percpu_ref *percpu_ref);
-
/*
* Set of flags that will prevent slab merging
*/
@@ -134,6 +132,8 @@ int __kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t=
flags, size_t nr,
LIST_HEAD(slab_root_caches);
static DEFINE_SPINLOCK(memcg_kmem_wq_lock);
=20
+static void kmemcg_queue_cache_shutdown(struct percpu_ref *percpu_ref);
+
void slab_init_memcg_params(struct kmem_cache *s)
{
s->memcg_params.root_cache =3D NULL;
--=20
2.20.1