From: Vladimir Davydov <vdavydov@parallels.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>, Tejun Heo <tj@kernel.org>,
Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Dave Chinner <david@fromorbit.com>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH -mm v2 4/7] slab: use css id for naming per memcg caches
Date: Mon, 19 Jan 2015 14:23:22 +0300 [thread overview]
Message-ID: <a7cf5287bcba440711c20801caf6068b46c53313.1421664712.git.vdavydov@parallels.com> (raw)
In-Reply-To: <cover.1421664712.git.vdavydov@parallels.com>
Currently, we use mem_cgroup->kmemcg_id to guarantee kmem_cache->name
uniqueness. This is correct, because kmemcg_id is only released on css
free after destroying all per memcg caches.
However, I am going to change that and release kmemcg_id on css offline,
because it is not wise to keep it for so long, wasting valuable entries
of memcg_cache_params->memcg_caches arrays. Therefore, to preserve cache
name uniqueness, let us switch to css->id.
Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
---
mm/slab_common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 6a5a1dde84c1..7f90acf3a3ff 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -487,6 +487,7 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg,
struct kmem_cache *root_cache)
{
static char memcg_name_buf[NAME_MAX + 1]; /* protected by slab_mutex */
+ struct cgroup_subsys_state *css = mem_cgroup_css(memcg);
struct memcg_cache_array *arr;
struct kmem_cache *s = NULL;
char *cache_name;
@@ -509,10 +510,9 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg,
if (arr->entries[idx])
goto out_unlock;
- cgroup_name(mem_cgroup_css(memcg)->cgroup,
- memcg_name_buf, sizeof(memcg_name_buf));
+ cgroup_name(css->cgroup, memcg_name_buf, sizeof(memcg_name_buf));
cache_name = kasprintf(GFP_KERNEL, "%s(%d:%s)", root_cache->name,
- idx, memcg_name_buf);
+ css->id, memcg_name_buf);
if (!cache_name)
goto out_unlock;
--
1.7.10.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-01-19 11:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 11:23 [PATCH -mm v2 0/7] memcg: release kmemcg_id on css offline Vladimir Davydov
2015-01-19 11:23 ` [PATCH -mm v2 1/7] slab: embed memcg_cache_params to kmem_cache Vladimir Davydov
2015-01-19 11:23 ` [PATCH -mm v2 2/7] slab: link memcg caches of the same kind into a list Vladimir Davydov
2015-01-19 11:23 ` [PATCH -mm v2 3/7] cgroup: release css->id after css_free Vladimir Davydov
2015-01-19 14:30 ` Tejun Heo
2015-01-19 15:18 ` Vladimir Davydov
2015-01-19 15:42 ` Tejun Heo
2015-01-19 11:23 ` Vladimir Davydov [this message]
2015-01-19 11:23 ` [PATCH -mm v2 5/7] memcg: free memcg_caches slot on css offline Vladimir Davydov
2015-01-19 11:23 ` [PATCH -mm v2 6/7] list_lru: add helpers to isolate items Vladimir Davydov
2015-01-19 11:23 ` [PATCH -mm v2 7/7] memcg: reparent list_lrus and free kmemcg_id on css offline Vladimir Davydov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a7cf5287bcba440711c20801caf6068b46c53313.1421664712.git.vdavydov@parallels.com \
--to=vdavydov@parallels.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=cl@linux.com \
--cc=david@fromorbit.com \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox