diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6f64bff8fe17ae03aabe13bad8446d47d6830b8e..badd043d58ac6b107502aa8be70cc02e559d6c52 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4863,7 +4863,8 @@ static void mem_cgroup_id_remove(struct mem_cgroup *memcg)
 	}
 }
 
-static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n)
+static void __maybe_unused mem_cgroup_id_get_many(struct mem_cgroup *memcg,
+						  unsigned int n)
 {
 	refcount_add(n, &memcg->id.ref);
 }