]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm: memcontrol: make cgroup_memory_nokmem static
authorMuchun Song <songmuchun@bytedance.com>
Fri, 14 Jan 2022 22:05:29 +0000 (14:05 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 15 Jan 2022 14:30:27 +0000 (16:30 +0200)
Commit 494c1dfe855e ("mm: memcg/slab: create a new set of kmalloc-cg-<n>
caches") makes cgroup_memory_nokmem global, however, it is unnecessary
because there is already a function mem_cgroup_kmem_disabled() which
exports it.

Just make it static and replace it with mem_cgroup_kmem_disabled() in
mm/slab_common.c.

Link: https://lkml.kernel.org/r/20211109065418.21693-1-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Chris Down <chris@chrisdown.name>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/internal.h
mm/memcontrol.c
mm/slab_common.c

index 3b79a5c9427a827e7646dbaf0abfe3b516c60a81..bdac62e1eca723a50a9ad1040bc118c002461dcc 100644 (file)
@@ -157,11 +157,6 @@ extern void reclaim_throttle(pg_data_t *pgdat, enum vmscan_throttle_state reason
  */
 extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address);
 
-/*
- * in mm/memcontrol.c:
- */
-extern bool cgroup_memory_nokmem;
-
 /*
  * in mm/page_alloc.c
  */
index 3542237c833fce239a425e01e0fd3c2b81734a59..bfe9bdec192b6de000c086baf961aae29da49a00 100644 (file)
@@ -84,7 +84,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(int_active_memcg);
 static bool cgroup_memory_nosocket __ro_after_init;
 
 /* Kernel memory accounting disabled? */
-bool cgroup_memory_nokmem __ro_after_init;
+static bool cgroup_memory_nokmem __ro_after_init;
 
 /* Whether the swap controller is active */
 #ifdef CONFIG_MEMCG_SWAP
index f02c32bd05ab85dcfcd3fb52e7bd475c00b90cb5..1f75bd4e95d63ab6cfb52bd0031932cbc2298e81 100644 (file)
@@ -844,7 +844,7 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags)
        if (type == KMALLOC_RECLAIM) {
                flags |= SLAB_RECLAIM_ACCOUNT;
        } else if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_CGROUP)) {
-               if (cgroup_memory_nokmem) {
+               if (mem_cgroup_kmem_disabled()) {
                        kmalloc_caches[type][idx] = kmalloc_caches[KMALLOC_NORMAL][idx];
                        return;
                }