[Devel] [PATCH] cgroup: tiny cleanups

2008-10-19 Thread Li Zefan
- remove 'private' field from struct subsys - remove cgroup_init_smp() - remove unused 'i' in cgroup_tasks_start() Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- include/linux/cgroup.h |4 kernel/cgroup.c|1 - 2 files changed, 5 deletions(-)

[Devel] [PATCH 1/4] freezer_cg: fix improper BUG_ON() causing oops

2008-10-20 Thread Li Zefan
The BUG_ON() should be protected by freezer->lock, otherwise it can be triggered easily when a task has been unfreezed but the corresponding cgroup hasn't been changed to FROZEN state. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup_freezer.c |3 ++- 1 fi

[Devel] [PATCH 3/4] freezer_cg: use thaw_process() in unfreeze_cgroup()

2008-10-20 Thread Li Zefan
Don't duplicate the implementation of thaw_process(). Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup_freezer.c | 15 --- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 6fadafe..3ea

[Devel] [PATCH 4/4] freezer_cg: simplify freezer_change_state()

2008-10-20 Thread Li Zefan
Just call unfreeze_cgroup() if goal_state == THAWED, and call try_to_freeze_cgroup() if goal_state == FROZEN. No behavior has been changed. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup_freezer.c | 19 +++ 1 files changed, 7 insertions(+), 12 deletions(-)

[Devel] [PATCH 2/4] freezer_cg: remove redundant check in freezer_can_attach()

2008-10-20 Thread Li Zefan
It is sufficient to check if @task is frozen, and no need to check if the original freezer is frozen. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup_freezer.c | 16 +++- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/kernel/cgroup_freezer.c b/

[Devel] Re: [PATCH 3/4] freezer_cg: use thaw_process() in unfreeze_cgroup()

2008-10-21 Thread Li Zefan
Cedric Le Goater wrote: > Li Zefan wrote: >> Don't duplicate the implementation of thaw_process(). > > looks OK but you should remove __thaw_process() which is unused > now. > Then I'll make it a static function and remo

[Devel] Re: [PATCH 2/4] freezer_cg: remove redundant check in freezer_can_attach()

2008-10-21 Thread Li Zefan
Cedric Le Goater wrote: > Li Zefan wrote: >> It is sufficient to check if @task is frozen, and no need to check if >> the original freezer is frozen. > > hmm, a task being frozen does not mean that its freezer cgroup is > frozen. If a task has being frozen, then can_at

[Devel] [PATCH] cgroup: fix invalid cgrp->dentry before cgroup has been completely removed

2008-10-30 Thread Li Zefan
90 ... Call Trace: [] ? print_cfs_rq+0x6e/0x75d [] ? sched_debug_show+0x72d/0xc1e ... Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 35eebd5..358e775 100644 ---

[Devel] Re: [PATCH] cgroup: fix invalid cgrp->dentry before cgroup has been completely removed

2008-10-30 Thread Li Zefan
Andrew Morton wrote: > On Thu, 30 Oct 2008 15:23:27 +0800 Li Zefan <[EMAIL PROTECTED]> wrote: > >> This fixes oops when reading /proc/sched_debug. > > In which kernel versions? The patch applies to 2.6.27 - should it be > aplied to 2.6.27.x? Earlier? > I think

[Devel] Re: [PATCH] cgroup: fix invalid cgrp->dentry before cgroup has been completely removed

2008-10-30 Thread Li Zefan
Paul Menage wrote: > On Thu, Oct 30, 2008 at 12:23 AM, Li Zefan <[EMAIL PROTECTED]> wrote: >> This fixes oops when reading /proc/sched_debug. >> >> A cgroup won't be removed completely until finishing cgroup_diput(), so we >> shouldn't invalidate cgrp-&

[Devel] [RFC][PATCH] freezer_cg: disable writing freezer.state of root cgroup

2008-11-03 Thread Li Zefan
With this change, the root cgroup is unfreezable, and writing to its freezer.state returns -EIO. I think it's reasonable to disallow freezing all the tasks in the root cgroup. And this avoids fork overhead when freezer subsystem is compiled but not used. Signed-off-by: Li Zefan <[EMAIL P

[Devel] Re: [PATCH 3/5] Container Freezer: Implement freezer cgroup subsystem

2008-11-03 Thread Li Zefan
Paul Menage wrote: > On Mon, Aug 11, 2008 at 3:53 PM, Matt Helsley <[EMAIL PROTECTED]> wrote: >> +} >> + >> +static void freezer_fork(struct cgroup_subsys *ss, struct task_struct *task) >> +{ >> + struct freezer *freezer; >> + >> + task_lock(task); >> + freezer = task_freezer(task

[Devel] Re: [RFC][PATCH] freezer_cg: disable writing freezer.state of root cgroup

2008-11-04 Thread Li Zefan
Paul Menage wrote: > On Mon, Nov 3, 2008 at 11:35 PM, Li Zefan <[EMAIL PROTECTED]> wrote: >> With this change, the root cgroup is unfreezable, and writing to >> its freezer.state returns -EIO. > > EINVAL might be more consistent with other systems like cpusets. >

[Devel] [PATCH] freezer_cg: remove task_lock from freezer_fork()

2008-11-03 Thread Li Zefan
task->cgroups won't be changed or invalidated. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup_freezer.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 7fa476f..6605907

[Devel] Re: [PATCH 3/5] Container Freezer: Implement freezer cgroup subsystem

2008-11-03 Thread Li Zefan
Paul Menage wrote: > On Mon, Nov 3, 2008 at 10:12 PM, Li Zefan <[EMAIL PROTECTED]> wrote: >> I think another reasonable and easier way is to disable writing freezer.state >> of top cgroup, so we can skip checks in freezer_fork() for tasks in top >> cgroup. >> >

[Devel] [PATCH -v2] freezer_cg: disable writing freezer.state of root cgroup

2008-11-05 Thread Li Zefan
riting invalid value to freezer.state returns EINVAL rather than EIO. This is more consistent with other cgroup subsystem. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- patch is based on freezer_cg-remove-task_lock-from-freezer_fork.patch --- Documentation/cgroups/freezer-subsys

[Devel] Re: [PATCH -v2] freezer_cg: disable writing freezer.state of root cgroup

2008-11-05 Thread Li Zefan
> Acked-by: Paul Menage <[EMAIL PROTECTED]> > > I might use the term "non-freezable" rather than "unfreezable". > My bad English :( patch updated. (some annoying leading tabs are also removed in the doc) ==== From: Li Zefan <[EMAI

[Devel] [PATCH -last version] freezer_cg: disable writing freezer.state of root cgroup

2008-11-05 Thread Li Zefan
Li Zefan wrote: >> Acked-by: Paul Menage <[EMAIL PROTECTED]> >> >> I might use the term "non-freezable" rather than "unfreezable". >> > > My bad English :( > > patch updated. (some annoying leading tabs are also removed in the doc)

[Devel] Re: [PATCH -last version] freezer_cg: disable writing freezer.state of root cgroup

2008-11-06 Thread Li Zefan
> I would make a small macro is_root_freezer() to show explicitly > what we are testing and use the CSS_ROOT bit to test. That's what > the CSS_ROOT bit is for Paul ? > I think yes CSS_ROOT can be used, though currently CSS_ROOT is used in cgroup internal only (in css_get() and css_put()). > if

[Devel] Re: [patch 1/4] io controller: documentation

2008-11-09 Thread Li Zefan
Hi, Vivek Thanks for your work. :) A question below. > +For example, assume there are two cgroups A and B with weights 1024 and 2048 > +in the system. Tasks in two cgroups A and B are doing IO to two disks sda and > +sdb in the system. A user has enabled IO control on both sda and sdb. Now on >

[Devel] Re: [PATCH 0/3] BFQ I/O Scheduler (second take)

2008-11-11 Thread Li Zefan
CC: Linux Containers <[EMAIL PROTECTED]> Vivek Goyal <[EMAIL PROTECTED]> Fabio Checconi wrote: > Hi Jens, hi all, > Hi Fabio, > this is an updated version of the patchset introducing the BFQ (Budget > Fair Queueing) I/O scheduler. It is based on CFQ and it has been > developed trying to

[Devel] Re: [PATCH] Dynamically allocate struct mem_cgroup_stat_cpu memory

2008-11-13 Thread Li Zefan
CC: KAMEZAWA Hiroyuki <[EMAIL PROTECTED]> CC: Balbir Singh <[EMAIL PROTECTED]> Andrew Morton wrote: > (cc [EMAIL PROTECTED]) > > On Thu, 13 Nov 2008 17:42:01 +0100 Jan Blunck <[EMAIL PROTECTED]> wrote: > >> When increasing NR_CPUS to 4096 the size of struct mem_cgroup is growing to >> 507904 byt

[Devel] Re: [PATCH] memcg: reduce size of per-cpu-stat to be appropriate size.

2008-11-13 Thread Li Zefan
good. > > This patch changes mem_cgroup's cpustat allocation not based > on NR_CPUS but based on nr_cpu_ids. > > From: Jan Blunck <[EMAIL PROTECTED]> > Signed-off-by: KAMEZAWA Hiroyuki <[EMAIL PROTECTED]> > Looks good :) . It's ok to use nr_cpu_ids when c

[Devel] Re: [PATCH] memcg: reduce size of per-cpu-stat to be appropriate size.

2008-11-13 Thread Li Zefan
>>> +static int mem_cgroup_size(void) >> inline this function? >> > necessary ? > Not so necessary IMO. It's called when a cgroup is created and removed, that is mkdir and rmdir, where performance is not critical. ___ Containers mailing list [EMAIL PR

[Devel] Re: [patch 0/4] [RFC] Another proportional weight IO controller

2008-11-17 Thread Li Zefan
Vivek Goyal wrote: > On Fri, Nov 14, 2008 at 02:44:22PM -0800, Nauman Rafique wrote: >> In an attempt to make sure that this discussion leads to >> something useful, we have summarized the points raised in this >> discussion and have come up with a strategy for future. >> The goal of this is to fin

[Devel] Re: [patch 0/4] [RFC] Another proportional weight IO controller

2008-11-17 Thread Li Zefan
t. Any comments on what approach looks better? > Looks like a sane way :) . We are also trying to keep track of the discussion and development of IO controller. I'll start to have a look into BFQ. > On Mon, Nov 17, 2008 at 6:02 PM, Li Zefan <[EMAIL PROTECTED]> wrote: >> Vivek

[Devel] [PATCH] cgroups: fix a serious bug in cgroupstats

2008-11-19 Thread Li Zefan
h, it returns EINVAL if we try to get cgroupstats from a normal file. CC: Balbir Singh <[EMAIL PROTECTED]> Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c inde

[Devel] Re: [PATCH] cgroups: fix a serious bug in cgroupstats

2008-11-19 Thread Li Zefan
> The patch applies OK to 2.6.25, 2.6.26 and to 2.6.27. I marked it as > needing backport to those kernel versions. Please let me know if that > was inappropriate. > Forgot to mention this: The bug exists from 2.6.24 (when cgroupstats is introduced) to now, though I didn't test in all those ve

[Devel] [PATCH] cgroups: documentation updates

2008-11-20 Thread Li Zefan
- remove 'releasable' since it has been moved to the debug subsys. - update lock requirements of subsys callbacks. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- Documentation/cgroups/cgroups.txt |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git

[Devel] [PATCH] cgroups: remove some redundant NULL checks

2008-11-20 Thread Li Zefan
of a cgroup_fs (using for_each_subsys), cgrp->subsys[ss->subsys_id] won't be NULL, guaranteed by cgroup_create(). (Also remove 2 unused variables in cgroup_rmdir(). Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup.c | 31 --- 1 files

[Devel] [PATCH] ns_cgroup: remove unused spinlock

2008-11-20 Thread Li Zefan
I happened to find the spinlock in struct ns_cgroup is never used. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/ns_cgroup.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/kernel/ns_cgroup.c b/kernel/ns_cgroup.c index 43c2111..78bc3fd 100644 --- a/

[Devel] [PATCH] memcg: fix a typo in Kconfig

2008-11-20 Thread Li Zefan
s/contoller/controller Signed-of-by: Li Zefan <[EMAIL PROTECTED]> --- init/Kconfig |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index f763762..8767393 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -414,7 +414,7 @@

[Devel] Re: [PATCH] cgroups: remove some redundant NULL checks

2008-11-20 Thread Li Zefan
of a cgroup_fs (using for_each_subsys), cgrp->subsys[ss->subsys_id] won't be NULL, guaranteed by cgroup_create(). (Also remove 2 unused variables in cgroup_rmdir(). Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- There was a compile warning..resend this patch. Sorry for b

[Devel] Re: [PATCH 1/2] cgroups: enhance task_cgroup()

2008-11-21 Thread Li Zefan
Paul Menage wrote: > On Fri, Nov 21, 2008 at 12:49 AM, Lai Jiangshan <[EMAIL PROTECTED]> wrote: >> task_cgroup() calls cgroup_subsys_state(). > > No, it calls task_subsys_state() > >> and we must use rcu_read_lock() to protect cgroup_subsys_state(). >> so we must use rcu_read_lock() to protect ta

[Devel] [PATCH 1/2] cgroups: cleanup for dummy root

2008-11-27 Thread Li Zefan
Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup.c | 24 ++-- 1 files changed, 2 insertions(+), 22 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c index fe00b3b..46d9981 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -84,7 +84,7 @@ stru

[Devel] [PATCH] cgroups: add link_css_set() to remove duplicate code

2008-11-27 Thread Li Zefan
Add a common function link_css_set() to link a css_set to a cgroup. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup.c | 51 ++- 1 files changed, 22 insertions(+), 29 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c

[Devel] Re: [PATCH] cgroups: add link_css_set() to remove duplicate code

2008-11-27 Thread Li Zefan
Li Zefan wrote: > Add a common function link_css_set() to link a css_set to a > cgroup. > > Signed-off-by: Li Zefan <[EMAIL PROTECTED]> I forgot the patch number..The title should be: [PATCH 2/2] cgroups: add link_css_set() to rem

[Devel] Re: [PATCH 1/2] cgroups: cleanup for dummy root

2008-11-28 Thread Li Zefan
Li Zefan wrote: > - Don't link rootnode to the root list, so root_list contains active > hierarchies only as the comment indicates. > > - Don't link css_sets to the dummy cgroup, because we never want to > run through the tasks in that dummpy cgroup (which means run

[Devel] [PATCH 2/3] cgroups: add inactive subsystems to rootnode.root_list

2008-11-28 Thread Li Zefan
.next == &ss->sibling) { ... } } if (list_empty(&rootnode.subsys_list)) { ... } The above code assumes rootnode.subsys_list links all inactive hierarchies. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> ---

[Devel] [PATCH 3/3] cgroups: introduce link_css_set() to remove duplicate code

2008-11-28 Thread Li Zefan
Add a common function link_css_set() to link a css_set to a cgroup. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgroup.c | 62 +- 1 files changed, 24 insertions(+), 38 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cg

[Devel] [PATCH 2/3 -v2] cgroups: add inactive subsystems to rootnode.subsys_list

2008-11-28 Thread Li Zefan
.next == &ss->sibling) { ... } } if (list_empty(&rootnode.subsys_list)) { ... } The above code assumes rootnode.subsys_list links all inactive hierarchies. Signed-off-by: Li Zefan <[EMAIL PROTECTED]> -

[Devel] [PATCH 1/3] cgroups: make root_list contains active hierarchies only

2008-11-28 Thread Li Zefan
Don't link rootnode to the root list, so root_list contains active hierarchies only as the comment indicates. And rename for_each_root() to for_each_active_root(). Also remove redundant check in cgroup_kill_sb(). Signed-off-by: Li Zefan <[EMAIL PROTECTED]> --- kernel/cgro

[Devel] Re: [PATCH 3/3] cgroups: introduce link_css_set() to remove duplicate code

2008-12-01 Thread Li Zefan
Paul Menage wrote: > On Fri, Nov 28, 2008 at 2:02 AM, Li Zefan <[EMAIL PROTECTED]> wrote: >> Add a common function link_css_set() to link a css_set to a cgroup. >> >> Signed-off-by: Li Zefan <[EMAIL PROTECTED]> > > Overall the change looks like an improvem

[Devel] Re: [PATCH 2/3] cgroups: add inactive subsystems to rootnode.root_list

2008-12-01 Thread Li Zefan
Paul Menage wrote: > On Fri, Nov 28, 2008 at 2:02 AM, Li Zefan <[EMAIL PROTECTED]> wrote: >> Though for an inactive hierarchy, we have subsys->root == &rootnode, >> but rootnode's root_list is always empty. > > I think you mean "rootnode's subsys_l

[Devel] Re: [PATCH 1/3] cgroups: make root_list contains active hierarchies only

2008-12-01 Thread Li Zefan
Paul Menage wrote: > On Fri, Nov 28, 2008 at 2:02 AM, Li Zefan <[EMAIL PROTECTED]> wrote: >> Don't link rootnode to the root list, so root_list contains active >> hierarchies only as the comment indicates. And rename for_each_root() >> to for_each_active_ro

[Devel] Re: [PATCH 2/3] cgroups: add inactive subsystems to rootnode.root_list

2008-12-02 Thread Li Zefan
@@ -2522,6 +2522,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss) printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name); /* Create the top cgroup state for this subsystem */ + list_add(&ss->sibling, &rootnode.root_list);

[Devel] Re: [PATCH] CGroups: Fix a race between rmdir and remount

2008-12-10 Thread Li Zefan
hy. > mkdir /mnt/cg > mount -t cgroup -o ns,freezer cgroup /mnt/cg > mkdir /mnt/cg/foo > sleep 1h < /mnt/cg/foo & > rmdir /mnt/cg/foo > mount -t cgroup -o remount,ns,devices,freezer cgroup /mnt/cg > kill $! > > Signed-off-by: Paul Menage <[EMAIL PROTECTED]> >

[Devel] Re: [RFC][PATCH 1/3] CGroups: Add a per-subsystem hierarchy_mutex

2008-12-10 Thread Li Zefan
> +static void cgroup_lock_hierarchy(struct cgroupfs_root *root) > +{ > + /* We need to take each hierarchy_mutex in a consistent order */ This comment is not so clear. Do you mean for_each_subsys() can't be used here? But this function is used in cgroup.c internally, and always called with c

[Devel] Re: [RFC][PATCH 2/3] CGroups: Use hierarchy_mutex in memory controller

2008-12-10 Thread Li Zefan
Balbir Singh wrote: > * KAMEZAWA Hiroyuki <[EMAIL PROTECTED]> [2008-12-11 10:05:01]: > >> On Wed, 10 Dec 2008 16:52:57 -0800 >> Paul Menage <[EMAIL PROTECTED]> wrote: >> >>> On Wed, Dec 10, 2008 at 4:49 PM, KAMEZAWA Hiroyuki >>> <[EMAIL PROTECTED]> wrote: an operation like rmdir() in s

[Devel] Re: ns_can_attach (nsproxy cgroup)

2008-12-12 Thread Li Zefan
> /** > - * cgroup_is_descendant - see if @cgrp is a descendant of current task's cgrp > + * cgroup_is_descendant - see if @cgrp is a descendant of @task's cgrp > * @cgrp: the cgroup in question > + * @task: the task in question > + * @subsys_id: cgroup subsystem id used to determine hierarchy;

[Devel] Re: ns_can_attach (nsproxy cgroup)

2008-12-16 Thread Li Zefan
ail with -EPERM and would have to be > performed as two steps: > echo $pid > /cgroup/CG1/tasks > echo $pid > /cgroup/CG1/CG2/tasks > Now looks good to me. :) Reviewed-by: Li Zefan > Signed-off-by: Grzegorz Nosek > --- > include/linux/cgroup.h |4 ++-- >

[Devel] Re: [PATCH] cgroups: add task along with its threads in one shot inside cgroup

2008-12-17 Thread Li Zefan
Gowrishankar M wrote: > From: Gowrishankar M > > In current model, task by task we populate cgroup. > Incase of multi-threaded task, it becomes difficult > as we should first know about list of threads created > and add them one by one in cgroup. > It was proposed to add 'procs' control file to

[Devel] Re: ns_can_attach (nsproxy cgroup)

2008-12-18 Thread Li Zefan
>> Now looks good to me. :) >> >> Reviewed-by: Li Zefan > > Thanks, shall I send the patch somewhere else for some mainstream tree > inclusion or is somebody willing to pick it up from here? > You can resend this patch to Andrew Morton , and CC Paul Menage si

[Devel] [PATCH] cgroups: avoid accessing uninitialized data in failure path

2008-12-22 Thread Li Zefan
If cgroup_get_rootdir() failed, free_cg_links() will be called in the failure path, but tmp_cg_links hasn't been initialized at that time. I should be blamed to introduce this bug in 2.6.26 merge window. Signed-off-by: Li Zefan --- kernel/cgroup.c |5 +++-- 1 files changed, 3 inser

[Devel] Re: [PATCH] cgroups: avoid accessing uninitialized data in failure path

2008-12-22 Thread Li Zefan
Li Zefan wrote: > If cgroup_get_rootdir() failed, free_cg_links() will be called > in the failure path, but tmp_cg_links hasn't been initialized > at that time. > > I should be blamed to introduce this bug in 2.6.26 merge window. > Sorry, I mean 2.6.27 merge window. &g

[Devel] [PATCH] cgroups: fix a race between cgroup_clone and umount

2008-12-24 Thread Li Zefan
0xf [] ? sysenter_do_call+0x12/0x31 ... EIP: [] cgroup_kill_sb+0x23/0xe0 SS:ESP 0068:e411ef2c ---[ end trace c766c1be3bf944ac ]--- CC: Serge E. Hallyn Signed-off-by: Li Zefan --- affected kernel: 2.6.24 to 2.6.28 --- kernel/cgroup.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/ker

[Devel] Re: - cgroups-relax-ns_can_attach-checks-to-allow-attaching-to-grandchild-cgroups.patch removed from -mm tree

2009-01-05 Thread Li Zefan
> echo $pid > /cgroup/CG1/tasks > echo $pid > /cgroup/CG1/CG2/tasks > > Signed-off-by: Grzegorz Nosek > Reviewed-by: Li Zefan > Cc: Paul Menage > Cc: Balbir Singh > Cc: KAMEZAWA Hiroyuki > Cc: Pavel Emelyanov > Signed-off-by: Andrew Morton > -

[Devel] Re: - cgroups-relax-ns_can_attach-checks-to-allow-attaching-to-grandchild-cgroups.patch removed from -mm tree

2009-01-05 Thread Li Zefan
Andrew Morton wrote: > On Tue, 06 Jan 2009 09:25:02 +0800 Li Zefan wrote: > >> a...@linux-foundation.org wrote: >>> The patch titled >>> cgroups: relax ns_can_attach checks to allow attaching to grandchild >>> cgroups >>> has b

[Devel] Re: [PATCH] Relax ns_can_attach checks to allow attaching to grandchild cgroups

2009-01-06 Thread Li Zefan
e. > > Signed-off-by: Grzegorz Nosek Reviewed-by: Li Zefan > --- > include/linux/cgroup.h |4 ++-- > kernel/cgroup.c| 11 ++- > kernel/ns_cgroup.c | 14 -- > 3 files changed, 12 insertions(+), 17 deletions(-) _

[Devel] Re: [RFC][PATCH] IP address restricting cgroup subsystem

2009-01-06 Thread Li Zefan
CC: net...@vger.kernel.org I'll review the cgroup part if this patch is regarded as useful. Grzegorz Nosek wrote: > This is a very simple cgroup subsystem to restrict IP addresses used > by member processes. Currently it is limited to IPv4 only but IPv6 (or > other protocols) should be easy to im

[Devel] Re: [RFC][PATCH] IP address restricting cgroup subsystem

2009-01-07 Thread Li Zefan
Grzegorz Nosek wrote: > On śro, sty 07, 2009 at 02:01:10 +0800, Li Zefan wrote: >> CC: net...@vger.kernel.org >> >> I'll review the cgroup part if this patch is regarded as useful. >> >> Grzegorz Nosek wrote: >>> This is a very simple cgroup subsys

[Devel] Re: [RFC][PATCH] IP address restricting cgroup subsystem

2009-01-07 Thread Li Zefan
Grzegorz Nosek wrote: > On śro, sty 07, 2009 at 04:36:35 +0800, Li Zefan wrote: >> Grzegorz Nosek wrote: >>>>> IP addresses are write-once (via /cgroup/.../ipaddr.ipv4 in dotted-quad >>>> Why they should be write-once ? >>> No real (technical) reaso

[Devel] [PATCH] cgroups: clean up Kconfig

2009-01-08 Thread Li Zefan
- move CONFIG_PROC_PID_CPUSET into cgroup menu - move MM_OWNER to the bottom for better menu indent - fix typos - use tabs not spaces Signed-off-by: Li Zefan --- init/Kconfig | 56 1 files changed, 28 insertions(+), 28 deletions

Re: [Devel] Re: [RFC][PATCH] IP address restricting cgroup subsystem

2009-01-09 Thread Li Zefan
Paul Menage wrote: > On Wed, Jan 7, 2009 at 1:33 AM, Li Zefan wrote: >>> Yes, I like that. Will update the patch. I assume that I must check >>> list_empty(&cgroup->children)? >> Yes. >> >>> Should I use cgroup_lock()/cgroup_unlock() >> Y

Re: [Devel] Re: [RFC][PATCH] IP address restricting cgroup subsystem

2009-01-11 Thread Li Zefan
Paul Menage wrote: > On Fri, Jan 9, 2009 at 8:50 PM, Li Zefan wrote: >>> For checking the "children" list, you can just lock >>> ipaddr_subsys.hierarchy_mutex. >>> >> Unfortunately hierarchy_mutex can't be used here, since hierarchy_mutex &

[Devel] Re: [PATCH] Relax ns_can_attach checks to allow attaching to grandchild cgroups

2009-01-12 Thread Li Zefan
>> /** >> - * cgroup_is_descendant - see if @cgrp is a descendant of current task's >> cgrp >> + * cgroup_is_descendant - see if @cgrp is a descendant of @task's cgrp >> * @cgrp: the cgroup in question >> + * @task: the task in question >> * >> - * See if @cgrp is a descendant of the current

Re: [Devel] Re: [RFC][PATCH] IP address restricting cgroup subsystem

2009-01-13 Thread Li Zefan
> That would be possible, but I'm not sure that extending > hierarchy_mutex across all the create calls is a good idea - it's > meant to be very lightweight. > agree > OK, an alternative way to avoid cgroup_lock() is for the > spinlock-protected state in ipcgroup to be the address and the count

[Devel] [RFC][PATCH] memcg: fix a race when setting memcg.swappiness

2009-01-13 Thread Li Zefan
ecking cgrp->children, that a cgroup is removed from parent's list in cgroup_rmdir(), while memcg->child_count is decremented in cgroup_diput(). Signed-off-by: Li Zefan --- mm/memcontrol.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/mm/memcon

[Devel] Re: [RFC][PATCH] memcg: fix a race when setting memcg.swappiness

2009-01-13 Thread Li Zefan
KAMEZAWA Hiroyuki wrote: > On Wed, 14 Jan 2009 11:24:18 +0800 > Li Zefan wrote: > >> (suppose: memcg->use_hierarchy == 0 and memcg->swappiness == 60) >> >> echo 10 > /memcg/0/swappiness | >> mem_cgroup_swappiness_write() | >> ...

[Devel] Re: [RFC][PATCH] memcg: fix a race when setting memcg.swappiness

2009-01-13 Thread Li Zefan
KAMEZAWA Hiroyuki wrote: > On Wed, 14 Jan 2009 14:47:18 +0800 > Li Zefan wrote: > >> KAMEZAWA Hiroyuki wrote: >>> On Wed, 14 Jan 2009 11:24:18 +0800 >>> Li Zefan wrote: >>> >>>> (suppose: memcg->use_hierarchy == 0 and memcg-&

[Devel] [PATCH] cgroups: fix lock inconsistency in cgroup_clone()

2009-01-19 Thread Li Zefan
I fixed a bug in cgroup_clone() in Linus' tree (commit 7b574b7), without noticing there was a cleanup patch in -mm tree that should be rebased (now commit 104cbd5), thus resulted in lock inconsistency. Signed-off-by: Li Zefan --- for 2.6.29 --- kernel/cgroup.c | 13 +++-- 1

[Devel] [PATCH] cgroups: fix lockdep subclasses overflow

2009-02-04 Thread Li Zefan
, but MAX_LOCKDEP_SUBCLASSES is 8. This patch uses different lockdep keys for different subsystems. Signed-off-by: Li Zefan --- include/linux/cgroup.h |1 + kernel/cgroup.c|3 ++- 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/include/linux/cgroup.h b/include/

[Devel] Re: [PATCH] cgroups: fix lockdep subclasses overflow

2009-02-04 Thread Li Zefan
Li Zefan wrote: > I enabled all cgroup subsystems when compiling kernel, and then: > # mount -t cgroup -o net_cls xxx /mnt > # mkdir /mnt/0 > > This showed up immediately: > BUG: MAX_LOCKDEP_SUBCLASSES too low! > turning off the locking correctness validator. > >

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-09 Thread Li Zefan
Andrew Morton wrote: > (cc's added) > > On Mon, 05 Jan 2009 11:23:33 +0800 Li Zefan wrote: > >> Thread 1: >> for ((; ;)) >> { >> mount -t cgroup -o cpuset xxx /mnt > /dev/null 2>&1 >> mkdir /mnt/0 > /dev/null 2>

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-09 Thread Li Zefan
Al Viro wrote: > On Mon, Feb 09, 2009 at 12:40:46AM -0800, Andrew Morton wrote: >>> Thread 1: >>> for ((; ;)) >>> { >>> mount -t cgroup -o cpuset xxx /mnt > /dev/null 2>&1 >>> mkdir /mnt/0 > /dev/null 2>&1 >>> rmdir /mnt/0 > /dev/null 2>&1 >>> umount /mnt > /dev/null 2>&

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-09 Thread Li Zefan
Al Viro wrote: > On Mon, Feb 09, 2009 at 11:03:48AM +, Al Viro wrote: >> BTW, a trivial note - kfree(root) in your ->kill_sb() is done >> earlier than it's nice to do. Shouldn't affect the problem, though. > Do you mean kfree(root) should be called after kill_litter_super()? I don't see

[Devel] [PATCH] cgroups: fix possible use after free

2009-02-10 Thread Li Zefan
In cgroup_kill_sb(), root is freed before sb is detached from the list, so another sget() may find this sb and call cgroup_test_super(), which will access the root that has been freed. Reported-by: Al Viro Signed-off-by: Li Zefan --- kernel/cgroup.c |2 +- 1 files changed, 1 insertions

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-11 Thread Li Zefan
Li Zefan wrote: > Al Viro wrote: >> On Mon, Feb 09, 2009 at 12:40:46AM -0800, Andrew Morton wrote: >>>> Thread 1: >>>> for ((; ;)) >>>> { >>>> mount -t cgroup -o cpuset xxx /mnt > /dev/null 2>&1 >>>&g

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-11 Thread Li Zefan
How cute... Same mountpoint in both, so these mount(2) will sometimes fail (cgroup picks the same sb on the same options, AFAICS) and fail silently due to these redirects... That's a lovely way to stress-test a large part of ro-bind stuff *and* umount()-related code.

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-11 Thread Li Zefan
Li Zefan wrote: >>>>> How cute... Same mountpoint in both, so these mount(2) will sometimes >>>>> fail (cgroup picks the same sb on the same options, AFAICS) and fail >>>>> silently due to these redirects... >>>>> >>>>

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-12 Thread Li Zefan
>> thread 1: >> for ((; ;)) >> { >> mount -t cgroup -o ns xxx cgroup/ > /dev/null 2>&1 >> # remove the dirs generated by cgroup_clone() >> rmdir cgroup/[1-9]* > /dev/null 2>&1 >> umount cgroup/ > /dev/null 2>&1 >> } >> >> >> thread 2: >> >> int foo(void *arg) >> { return 0; } >>

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-12 Thread Li Zefan
Al Viro wrote: > On Fri, Feb 13, 2009 at 01:09:17PM +0800, Li Zefan wrote: > >> I ran following testcase, and triggered the warning in 1 hour: >> >> thread 1: >> for ((; ;)) >> { >> mount --bind /cgroup /mnt > /dev/null 2>&1 >&g

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-12 Thread Li Zefan
Li Zefan wrote: > Al Viro wrote: >> On Fri, Feb 13, 2009 at 01:09:17PM +0800, Li Zefan wrote: >> >>> I ran following testcase, and triggered the warning in 1 hour: >>> >>> thread 1: >>> for ((; ;)) >>> { >>> mount --bin

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-12 Thread Li Zefan
Al Viro wrote: > On Fri, Feb 13, 2009 at 06:41:35AM +, Al Viro wrote: > > Aaaargh... > > /* > * We don't have to hold all of the locks at the > * same time here because we know that we're the > * last reference to mnt and that no new writers > * can

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-15 Thread Li Zefan
Li Zefan wrote: > Al Viro wrote: >> On Fri, Feb 13, 2009 at 06:41:35AM +, Al Viro wrote: >> >> Aaaargh... >> >> /* >> * We don't have to hold all of the locks at the >> * same time here because we know that we're

[Devel] Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()

2009-02-15 Thread Li Zefan
done by another > CPU. > If this is done, I'll be available to test it. > Anyway, for now (HEAD and all -stable starting with 2.6.26) we want this: > And here is my: Tested-by: Li Zefan > --- fs/namespace.c2009-01-25 21:45:31.00

[Devel] [PATCH] cgroups: update documentation about css_set hash table

2009-02-17 Thread Li Zefan
The css_set hash table was introduced in 2.6.26, so update the documentation accordingly. Signed-off-by: Li Zefan --- Documentation/cgroups/cgroups.txt |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups

[Devel] Re: Question for remount

2009-02-22 Thread Li Zefan
> 1. Documentation/cgroups/cgroup.txt says >#mount -oremount,cpuset,ns /dev/cgroup >But this should be >#mount -tcgroup none /dev/cgroup -oremount,cpuset,ns > I agree. Actually I noticed this long ago. Doing this won't remove cpuacct from the cgroup hierarchy: # mount -t cgroup -o cp

[Devel] Re: Question for remount

2009-02-22 Thread Li Zefan
KAMEZAWA Hiroyuki wrote: > Paul Menage さんは書きました: >> On Fri, Feb 20, 2009 at 2:02 AM, KAMEZAWA Hiroyuki >> wrote: >>> 2. /proc/mounts information of release_agent should be updated >>> when it's overwritten directly. >> Yes, definitely. But shouldn't that happen already? >> cgroup_show_option

[Devel] Re: Question for remount

2009-02-22 Thread Li Zefan
Li Zefan wrote: >> 1. Documentation/cgroups/cgroup.txt says >>#mount -oremount,cpuset,ns /dev/cgroup >>But this should be >>#mount -tcgroup none /dev/cgroup -oremount,cpuset,ns >> > > I agree. Actually I noticed this long ago. > > Doing

[Devel] Re: Question for remount

2009-02-23 Thread Li Zefan
KAMEZAWA Hiroyuki wrote: > On Mon, 23 Feb 2009 10:32:46 +0800 > Li Zefan wrote: > >> KAMEZAWA Hiroyuki wrote: >>> Paul Menage さんは書きました: >>>> On Fri, Feb 20, 2009 at 2:02 AM, KAMEZAWA Hiroyuki >>>> wrote: >>>>> 2. /proc/mounts infor

[Devel] Re: Question for remount

2009-02-23 Thread Li Zefan
>> To change the set of subsystems bound to a mounted hierarchy, just >> remount with different options: >> +# mount -o remount,cpuset,ns hier1 /dev/cgroup >> >> -# mount -o remount,cpuset,ns /dev/cgroup >> +Now numtasks is removed from the hierarchy and ns is added. >> + >> +Note this will ad

[Devel] [PATCH] cgroups: more documentation for remount and release_agent

2009-02-23 Thread Li Zefan
Also document how to specify or change release_agent. Signed-off-by: Li Zefan --- Documentation/cgroups/cgroups.txt | 20 ++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt index 93feb84..df

[Devel] Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file

2009-02-25 Thread Li Zefan
al issue, that some files are read-only in top-cgroup, but read-write in sub-dirs, like cpuset.cpus and cpuset.mems. But for those files, they must have a write function, so I think it's still valid to mask them as read-write even they are in top-cgroup. Unless Paul has different option towar

[Devel] Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file

2009-02-26 Thread Li Zefan
> But I don't see why we can't figure out the mode automatically based > on whether or not there's a write handler defined for the control > file. > This almost works.. except for 'tasks' file, which has no 'read' handler but is readable. ___ Container

[Devel] [PATCH 0/4] cgroups: show correct file mode

2009-03-01 Thread Li Zefan
Now a cgroup subsystem can set default file mode of its control files, so here is a patchset to correct file mode of each subsystem's files. Should be applied after: cgroup-allow-subsys-to-set-default-mode-of-its-own-file.patch [PATCH 1/4] cgroup debug: show correct file mode [PATCH 2/4]

[Devel] [PATCH 1/4] cgroup debug: show correct file mode

2009-03-01 Thread Li Zefan
All control files in debug subsystem are read-only. Signed-off-by: Li Zefan --- kernel/cgroup_debug.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/kernel/cgroup_debug.c b/kernel/cgroup_debug.c index daca620..2ba54c6 100644 --- a/kernel/cgroup_debug.c +++ b/kernel

[Devel] [PATCH 2/4] cpuacct: show correct file mode

2009-03-01 Thread Li Zefan
cpuacct.usage_percpu is read-only. Signed-off-by: Li Zefan --- kernel/sched.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index e66f009..638aa4d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -9734,6 +9734,7 @@ static struct

[Devel] [PATCH 3/4] devcgroup: show correct file mode

2009-03-01 Thread Li Zefan
devices.allow and devices.deny are write-only, and devices.list is read-only. Signed-off-by: Li Zefan --- security/device_cgroup.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 3aacd0f..b13fbb8 100644 --- a

[Devel] [PATCH 4/4] cpuset: show correct file mode

2009-03-01 Thread Li Zefan
cpuset.memory_pressure is read-only. Signed-off-by: Li Zefan --- kernel/cpuset.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/kernel/cpuset.c b/kernel/cpuset.c index a46d693..1ed507c 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -1671,6 +1671,7 @@ static

  1   2   3   4   5   >