Skip to contentSkip to conversation

+ mm-memcontrolc-memcg_create_kmem_cache-tweaks.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Jan 30, 2014

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + mm-memcontrolc-memcg_create_kmem_cache-tweaks.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 30 Jan 2014 13:01:52 -0800

The patch titled
Subject: mm/memcontrol.c: memcg_create_kmem_cache() tweaks
has been added to the -mm tree. Its filename is
mm-memcontrolc-memcg_create_kmem_cache-tweaks.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-memcontrolc-memcg_create_kmem_cache-tweaks.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-memcontrolc-memcg_create_kmem_cache-tweaks.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Andrew Morton <[email protected]>
Subject: mm/memcontrol.c: memcg_create_kmem_cache() tweaks

Allocate tmp_name on demand rather than permanently consuming PATH_MAX bytes of memory. This permits a small reduction in the mutex hold time as well.

Cc Glauber Costa <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Vladimir Davydov <[email protected]>

---

 mm/memcontrol.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
mm/memcontrol.c renamed from mm/memcontrol.c~mm-memcontrolc-memcg_create_kmem_cache-tweaks +5 -6
diff -puN mm/memcontrol.c~mm-memcontrolc-memcg_create_kmem_cache-tweaks mm/memcontrol.c
@@ -3401,17 +3401,14 @@ static struct kmem_cache *memcg_create_k
 						  struct kmem_cache *s)
 {
 	struct kmem_cache *new = NULL;
-	static char *tmp_name = NULL;
+	static char *tmp_name;
 	static DEFINE_MUTEX(mutex);	/* protects tmp_name */
 
 	BUG_ON(!memcg_can_account_kmem(memcg));
 
-	mutex_lock(&mutex);
 	/*
-	 * kmem_cache_create_memcg duplicates the given name and
-	 * cgroup_name for this name requires RCU context.
-	 * This static temporary buffer is used to prevent from
-	 * pointless shortliving allocation.
+	 * kmem_cache_create_memcg duplicates the given name and cgroup_name()
+	 * for this name requires rcu_read_lock().
 	 */
 	if (!tmp_name) {
 		tmp_name = kmalloc(PATH_MAX, GFP_KERNEL);
@@ -3419,6 +3416,7 @@ static struct kmem_cache *memcg_create_k
 			goto out;
 	}
 
+	mutex_lock(&mutex);
 	rcu_read_lock();
 	snprintf(tmp_name, PATH_MAX, "%s(%d:%s)", s->name,
 			 memcg_cache_id(memcg), cgroup_name(memcg->css.cgroup));
@@ -3432,6 +3430,7 @@ static struct kmem_cache *memcg_create_k
 		new = s;
 out:
 	mutex_unlock(&mutex);
+	kfree(tmp_name);
 	return new;
 }
 

_

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

origin.patch
arch-alpha-kernel-systblss-remove-debug-check.patch
i-need-old-gcc.patch numa-mem-hotplug-initialize-numa_kernel_nodes-in-numa_clear_kernel_node_hotplug-fix.patch input-route-kbd-leds-through-the-generic-leds-layer.patch ocfs2-fix-ocfs2_sync_file-if-filesystem-is-readonly-fix.patch ocfs2-free-allocated-clusters-if-error-occurs-after-ocfs2_claim_clusters-fix.patch mm.patch
mm-memcontrolc-memcg_create_kmem_cache-tweaks.patch mm-swap-fix-race-on-swap_info-reuse-between-swapoff-and-swapon-fix.patch kmod-run-usermodehelpers-only-on-cpus-allowed-for-kthreadd-v2-fix.patch kmod-run-usermodehelpers-only-on-cpus-allowed-for-kthreadd-v2-checkpatch-fixes.patch linux-next.patch
linux-next-git-rejects.patch
debugging-keep-track-of-page-owners.patch journal_add_journal_head-debug.patch kernel-forkc-export-kernel_thread-to-modules.patch mutex-subsystem-synchro-test-module.patch
slab-leaks3-default-y.patch
put_bh-debug.patch