]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm-memcg-slab-create-a-new-set-of-kmalloc-cg-n-caches-v5-fix
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 2 Jun 2021 03:52:14 +0000 (13:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 2 Jun 2021 03:52:14 +0000 (13:52 +1000)
un-fat-finger v5 delta creation

Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Waiman Long <longman@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
mm/internal.h
mm/memcontrol.c
mm/slab_common.c

index 2f1182948aa6e7a6603515c4dfe6e8eabfded734..4db89a7838d24f36f47f2e8a3e624b050547e6cb 100644 (file)
@@ -115,6 +115,11 @@ extern void putback_lru_page(struct page *page);
  */
 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 2508bd97349c12f730b1f9f9684d1eb918e79449..b913950b9f64c5e48dcfa352b2a07d67a836e26b 100644 (file)
@@ -83,7 +83,7 @@ DEFINE_PER_CPU(struct mem_cgroup *, int_active_memcg);
 static bool cgroup_memory_nosocket;
 
 /* Kernel memory accounting disabled? */
-static bool cgroup_memory_nokmem;
+bool cgroup_memory_nokmem;
 
 /* Whether the swap controller is active */
 #ifdef CONFIG_MEMCG_SWAP
index 0ad7d78d0a58e9b9ae5bcbed8927ff553605f505..629b4460de4d238b41dbbaba55a05789275bb7c0 100644 (file)
@@ -841,10 +841,15 @@ void __init setup_kmalloc_cache_index_table(void)
 static void __init
 new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags)
 {
-       if (type == KMALLOC_RECLAIM)
+       if (type == KMALLOC_RECLAIM) {
                flags |= SLAB_RECLAIM_ACCOUNT;
-       else if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_CGROUP))
+       } else if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_CGROUP)) {
+               if (cgroup_memory_nokmem) {
+                       kmalloc_caches[type][idx] = kmalloc_caches[KMALLOC_NORMAL][idx];
+                       return;
+               }
                flags |= SLAB_ACCOUNT;
+       }
 
        kmalloc_caches[type][idx] = create_kmalloc_cache(
                                        kmalloc_info[idx].name[type],