From: Li Zefan <lizf@cn.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"menage@google.com" <menage@google.com>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/3] cgroup: fix pre_destroy and semantics of css->refcnt
Date: Wed, 03 Dec 2008 11:44:36 +0800 [thread overview]
Message-ID: <493600A4.6040802@cn.fujitsu.com> (raw)
In-Reply-To: <20081201150208.6b24506b.kamezawa.hiroyu@jp.fujitsu.com>
> +/*
> + * Try to set all subsys's refcnt to be 0.
> + * css->refcnt==0 means this subsys will be destroy()'d.
> + */
> +static bool cgroup_set_subsys_removed(struct cgroup *cgrp)
> +{
> + struct cgroup_subsys *ss;
> + struct cgroup_subsys_state *css, *tmp;
> +
> + for_each_subsys(cgrp->root, ss) {
> + css = cgrp->subsys[ss->subsys_id];
> + if (!atomic_dec_and_test(&css->refcnt))
> + goto rollback;
> + }
> + return true;
> +rollback:
> + for_each_subsys(cgrp->root, ss) {
> + tmp = cgrp->subsys[ss->subsys_id];
> + atomic_inc(&tmp->refcnt);
> + if (tmp == css)
> + break;
> + }
> + return false;
> +}
> +
This function may return false, then causes rmdir() fail. So css_tryget(subsys1)
returns 0 doesn't necessarily mean subsys1->destroy() will be called,
if subsys2's css's refcnt is >1 when cgroup_set_subsys_removed() is called.
Will this bring up bugs and problems?
--
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-03 3:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-01 5:59 [PATCH 0/3] cgroup id and scanning without cgroup_lock KAMEZAWA Hiroyuki
2008-12-01 6:02 ` [PATCH 1/3] cgroup: fix pre_destroy and semantics of css->refcnt KAMEZAWA Hiroyuki
2008-12-02 6:15 ` Li Zefan
2008-12-02 6:21 ` KAMEZAWA Hiroyuki
2008-12-02 6:56 ` Li Zefan
2008-12-02 7:13 ` KAMEZAWA Hiroyuki
2008-12-02 7:31 ` Li Zefan
2008-12-02 7:39 ` KAMEZAWA Hiroyuki
2008-12-03 3:44 ` Li Zefan [this message]
2008-12-03 3:54 ` KAMEZAWA Hiroyuki
2008-12-01 6:03 ` [PATCH 2/3] cgroup: cgroup ID and scanning under RCU KAMEZAWA Hiroyuki
2008-12-01 6:04 ` [PATCH 3/3] memcg: change hierarhcy managenemt to use scan by cgroup ID KAMEZAWA Hiroyuki
2008-12-01 6:24 ` [PATCH 0/3] cgroup id and scanning without cgroup_lock Balbir Singh
2008-12-01 7:52 ` 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=493600A4.6040802@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@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