From: Li Zefan <lizf@cn.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
"menage@google.com" <menage@google.com>,
"kosaki.motohiro@jp.fujitsu.com" <kosaki.motohiro@jp.fujitsu.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 1/6] memcg: fix pre_destory handler
Date: Wed, 10 Dec 2008 10:19:35 +0800 [thread overview]
Message-ID: <493F2737.9060901@cn.fujitsu.com> (raw)
In-Reply-To: <20081209200647.a1fa76a9.kamezawa.hiroyu@jp.fujitsu.com>
> +static bool memcg_is_obsolete(struct mem_cgroup *mem)
> +{
Will this function be called with mem->css.refcnt == 0? If yes, then
this function is racy.
cg = mem->css.cgroup
cgroup_diput()
mem_cgroup_destroy()
mem->css.cgroup = NULL;
kfree(cg);
if (!cg || cgroup_is_removed(cg)...)
(accessing invalid cg)
> + struct cgroup *cg = mem->css.cgroup;
> + /*
> + * "Being Removed" means pre_destroy() handler is called.
> + * After "pre_destroy" handler is called, memcg should not
> + * have any additional charges.
> + * This means there are small races for mis-accounting. But this
> + * mis-accounting should happen only under swap-in opration.
> + * (Attachin new task will fail if cgroup is under rmdir()).
> + */
> +
> + if (!cg || cgroup_is_removed(cg) || cgroup_is_being_removed(cg))
> + return true;
> + return false;
> +}
> +
...
> static void mem_cgroup_destroy(struct cgroup_subsys *ss,
> struct cgroup *cont)
> {
> - mem_cgroup_free(mem_cgroup_from_cont(cont));
> + struct mem_cgroup *mem = mem_cgroup_from_cont(cont):
> + mem_cgroup_free(mem);
> + /* forget */
> + mem->css.cgroup = NULL;
mem might already be destroyed by mem_cgroup_free(mem).
> }
--
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:[~2008-12-10 2:19 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 11:02 [RFC][PATCH 0/6] cgroup id and mix fixes (2008/12/09) KAMEZAWA Hiroyuki
2008-12-09 11:04 ` [RFC][PATCH 1/6] memcg: Documentation for internal implementation KAMEZAWA Hiroyuki
2008-12-10 0:27 ` KAMEZAWA Hiroyuki
2008-12-10 1:02 ` Li Zefan
2008-12-10 1:07 ` KAMEZAWA Hiroyuki
2008-12-09 11:06 ` [RFC][PATCH 1/6] memcg: fix pre_destory handler KAMEZAWA Hiroyuki
2008-12-10 2:08 ` KAMEZAWA Hiroyuki
2008-12-10 2:19 ` Li Zefan [this message]
2008-12-10 2:23 ` KAMEZAWA Hiroyuki
2008-12-10 2:28 ` Daisuke Nishimura
2008-12-10 2:58 ` KAMEZAWA Hiroyuki
2008-12-10 3:03 ` Daisuke Nishimura
2008-12-10 4:17 ` KAMEZAWA Hiroyuki
2008-12-10 10:40 ` Paul Menage
2008-12-10 11:29 ` KAMEZAWA Hiroyuki
2008-12-10 13:25 ` Balbir Singh
2008-12-10 13:47 ` Daisuke Nishimura
2008-12-10 18:26 ` Paul Menage
2008-12-10 18:25 ` Paul Menage
2008-12-10 18:35 ` Paul Menage
2008-12-10 19:00 ` Paul Menage
2008-12-11 0:21 ` KAMEZAWA Hiroyuki
2008-12-11 0:24 ` Paul Menage
2008-12-11 1:06 ` KAMEZAWA Hiroyuki
2008-12-11 12:43 ` KAMEZAWA Hiroyuki
2008-12-11 0:25 ` KAMEZAWA Hiroyuki
2008-12-11 0:28 ` Paul Menage
2008-12-11 1:09 ` KAMEZAWA Hiroyuki
2008-12-09 11:08 ` [RFC][PATCH 2/6] cgroup id KAMEZAWA Hiroyuki
2008-12-09 11:09 ` [RFC][PATCH 4/6] Flat hierarchical reclaim by ID KAMEZAWA Hiroyuki
2008-12-09 12:27 ` Balbir Singh
2008-12-09 14:28 ` KAMEZAWA Hiroyuki
2008-12-09 15:46 ` Balbir Singh
2008-12-09 16:34 ` KAMEZAWA Hiroyuki
2008-12-10 2:49 ` Balbir Singh
2008-12-10 3:03 ` KAMEZAWA Hiroyuki
2008-12-09 11:10 ` [RFC][PATCH 5/6] fix inactive_ratio under hierarchy KAMEZAWA Hiroyuki
2008-12-11 3:14 ` KOSAKI Motohiro
2008-12-11 3:19 ` KAMEZAWA Hiroyuki
2008-12-09 11:12 ` [RFC][PATCH 6/6] fix oom " KAMEZAWA Hiroyuki
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=493F2737.9060901@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
--cc=nishimura@mxp.nes.nec.co.jp \
/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