From: Li Zefan <lizf@cn.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.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>,
taka@valinux.co.jp
Subject: Re: [RFC][PATCH 1/2] CGROUP ID and Hierarchy Code
Date: Fri, 28 Nov 2008 10:38:26 +0800 [thread overview]
Message-ID: <492F59A2.3000104@cn.fujitsu.com> (raw)
In-Reply-To: <20081128111832.b52a6909.kamezawa.hiroyu@jp.fujitsu.com>
KAMEZAWA Hiroyuki wrote:
> On Fri, 28 Nov 2008 10:35:33 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
>> On Fri, 28 Nov 2008 09:28:33 +0800
>> Li Zefan <lizf@cn.fujitsu.com> wrote:
>
>>> I think the safe way is:
>>>
>>> rcu_read_lock();
>>> cgrp = cgroup_get_next()
>>> if (!inc_not_zero(cgrp) {
>>> rcu_read_unlock();
>>> return NULL;
>>> }
>>> rcu_read_unlock();
>>> return cgrp;
>>>
>>> But it's also safe to use cgrp = list_entry(&parent->children.next) for the above
>>> scenario, seems you don't have to invent this cgroup_get_next().
>>>
>> But list-walk can't provide us view of hierarchy. Up-Down list walk is better ?
>> please see memcg's code. it met some troubles.
>> I'll make kfree(cgrp) to be called by RCU.
>>
>
> Ah please, I have a question.
> Following is right ?
> - until mount, cgroup's subsystem root is tied to dummy? root cgroup.
Yes.
> - cgroup cannot be unmounted while there are any children.
No, you can unmount. You can have it a try. :)
> - cgroup_root is freed/allocated at umount/mount, then I have to handle
No, kill_sb() is called when deactivate_super() decreases sb->s_active to 0, and
whenever we create a cgroup, sb->s_active is increased, so if there are sub-dirs
the cgroup_root won't be freed at umount.
> this event in cgroup-id.
> (maybe current code has leak? in umount.)
>
So I think there is no leak. ;)
> Thanks,
> -Kame
>
>
>
next prev parent reply other threads:[~2008-11-28 2:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-27 7:05 KAMEZAWA Hiroyuki
2008-11-27 7:08 ` [RFC][PATCH 2/2] memcg: hierarchy reclaim with CGROUP ID KAMEZAWA Hiroyuki
2008-11-27 7:46 ` [RFC][PATCH 1/2] CGROUP ID and Hierarchy Code Daisuke Nishimura
2008-11-27 8:00 ` KAMEZAWA Hiroyuki
2008-11-27 18:54 ` Balbir Singh
2008-11-28 0:08 ` KAMEZAWA Hiroyuki
2008-11-28 1:28 ` Li Zefan
2008-11-28 1:35 ` KAMEZAWA Hiroyuki
2008-11-28 1:51 ` KAMEZAWA Hiroyuki
2008-11-28 2:18 ` KAMEZAWA Hiroyuki
2008-11-28 2:38 ` Li Zefan [this message]
2008-11-28 2:41 ` 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=492F59A2.3000104@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=nishimura@mxp.nes.nec.co.jp \
--cc=taka@valinux.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
all inboxes | Powered by JetHome®