From: Li Zefan <lizefan@huawei.com>
To: Glauber Costa <glommer@openvz.org>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Dave Chinner <david@fromorbit.com>,
Anton Vorontsov <anton.vorontsov@linaro.org>,
John Stultz <john.stultz@linaro.org>,
Joonsoo Kim <js1304@gmail.com>, Michal Hocko <mhocko@suse.cz>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH 2/2] memcg: reap dead memcgs under pressure
Date: Thu, 25 Apr 2013 20:50:14 +0800 [thread overview]
Message-ID: <51792686.50009@huawei.com> (raw)
In-Reply-To: <1366705329-9426-3-git-send-email-glommer@openvz.org>
> +static void memcg_vmpressure_shrink_dead(void)
> +{
> + struct memcg_cache_params *params, *tmp;
> + struct kmem_cache *cachep;
> + struct mem_cgroup *memcg;
> +
> + mutex_lock(&dangling_memcgs_mutex);
> + list_for_each_entry(memcg, &dangling_memcgs, dead) {
> +
> + mem_cgroup_get(memcg);
This mem_cgroup_get() looks redundant to me, because you're iterating the list
and never release dangling_memcgs_mutex in the middle.
> + mutex_lock(&memcg->slab_caches_mutex);
> + /* The element may go away as an indirect result of shrink */
> + list_for_each_entry_safe(params, tmp,
> + &memcg->memcg_slab_caches, list) {
> +
> + cachep = memcg_params_to_cache(params);
> + /*
> + * the cpu_hotplug lock is taken in kmem_cache_create
> + * outside the slab_caches_mutex manipulation. It will
> + * be taken by kmem_cache_shrink to flush the cache.
> + * So we need to drop the lock. It is all right because
> + * the lock only protects elements moving in and out the
> + * list.
> + */
> + mutex_unlock(&memcg->slab_caches_mutex);
> + kmem_cache_shrink(cachep);
> + mutex_lock(&memcg->slab_caches_mutex);
> + }
> + mutex_unlock(&memcg->slab_caches_mutex);
> + mem_cgroup_put(memcg);
> + }
> + mutex_unlock(&dangling_memcgs_mutex);
> +}
--
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:[~2013-04-25 12:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-23 8:22 [PATCH 0/2] reuse vmpressure for in-kernel events Glauber Costa
2013-04-23 8:22 ` [PATCH 1/2] vmpressure: in-kernel notifications Glauber Costa
2013-04-23 17:11 ` Anton Vorontsov
2013-04-23 18:17 ` Glauber Costa
2013-04-23 19:13 ` Pekka Enberg
2013-04-23 20:24 ` Anton Vorontsov
2013-04-23 21:01 ` Anton Vorontsov
2013-04-24 6:26 ` Glauber Costa
2013-04-24 11:20 ` Glauber Costa
2013-04-24 7:21 ` Greg Thelen
2013-04-24 8:36 ` Glauber Costa
2013-04-24 19:35 ` Greg Thelen
2013-04-24 19:42 ` Greg Thelen
2013-04-24 20:04 ` Glauber Costa
2013-04-25 10:50 ` Glauber Costa
2013-04-25 18:34 ` Greg Thelen
2013-04-23 8:22 ` [PATCH 2/2] memcg: reap dead memcgs under pressure Glauber Costa
2013-04-25 12:50 ` Li Zefan [this message]
2013-04-26 7:38 ` Glauber Costa
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=51792686.50009@huawei.com \
--to=lizefan@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=anton.vorontsov@linaro.org \
--cc=cgroups@vger.kernel.org \
--cc=david@fromorbit.com \
--cc=glommer@openvz.org \
--cc=hannes@cmpxchg.org \
--cc=john.stultz@linaro.org \
--cc=js1304@gmail.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).