Skip to contentSkip to conversation

mm-memcg-slab-disable-cache-merging-for-kmalloc_normal-caches.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jul 6, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm: memcg/slab: disable cache merging for KMALLOC_NORMAL caches
has been removed from the -mm tree. Its filename was
mm-memcg-slab-disable-cache-merging-for-kmalloc_normal-caches.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Waiman Long <[email protected]>
Subject: mm: memcg/slab: disable cache merging for KMALLOC_NORMAL caches

The KMALLOC_NORMAL (kmalloc-<n>) caches are for unaccounted objects only when CONFIG_MEMCG_KMEM is enabled. To make sure that this condition remains true, we will have to prevent KMALOC_NORMAL caches to merge with other kmem caches. This is now done by setting its refcount to -1 right after its creation.

---

 mm/slab_common.c |    7 +++++++
 1 file changed, 7 insertions(+)
mm/slab_common.c renamed from mm/slab_common.c~mm-memcg-slab-disable-cache-merging-for-kmalloc_normal-caches +7 -0
@@ -856,6 +856,13 @@ new_kmalloc_cache(int idx, enum kmalloc_
 					kmalloc_info[idx].name[type],
 					kmalloc_info[idx].size, flags, 0,
 					kmalloc_info[idx].size);
+
+	/*
+	 * If CONFIG_MEMCG_KMEM is enabled, disable cache merging for
+	 * KMALLOC_NORMAL caches.
+	 */
+	if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_NORMAL))
+		kmalloc_caches[type][idx]->refcount = -1;
 }
 
 /*

_

Patches currently in -mm which might be from [email protected] are