Re: [RFC][PATCH 1/4] cgroup: support per cgroup subsys state ID(CSS ID)
From: KAMEZAWA Hiroyuki
Date: Thu Jan 08 2009 - 23:25:26 EST
On Fri, 09 Jan 2009 11:59:05 +0800
Li Zefan <lizf@xxxxxxxxxxxxxx> wrote:
> > static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb)
> > {
> > struct inode *inode = new_inode(sb);
> > @@ -2335,6 +2339,7 @@ static void init_cgroup_css(struct cgrou
> > css->cgroup = cgrp;
> > atomic_set(&css->refcnt, 1);
> > css->flags = 0;
> > + css->id = NULL;
> > if (cgrp == dummytop)
> > set_bit(CSS_ROOT, &css->flags);
> > BUG_ON(cgrp->subsys[ss->subsys_id]);
> > @@ -2410,6 +2415,10 @@ static long cgroup_create(struct cgroup
> > goto err_destroy;
> > }
> > init_cgroup_css(css, ss, cgrp);
> > + if (ss->use_id)
> > + if (alloc_css_id(ss, parent, cgrp))
> > + goto err_destroy;
> > + /* At error, ->destroy() callback has to free assigned ID. */
>
> A bug here:
>
> if alloc_css_id(ss, parent, cgrp) failed, then ss->destroy() called free_css_id(),
> then panic.
>
> maybe check if (css->id == NULL) in free_css_id() ?
>
Oh, thanks. it will be necessary.
I'll fix it.
But..Hmm...maybe it's useful to add fault injection feature to debug cgroup
for this kind of loop operation.
-Kame
> > }
> >
> > cgroup_lock_hierarchy(root);
> > @@ -2699,6 +2708,8 @@ int __init cgroup_init(void)
> > struct cgroup_subsys *ss = subsys[i];
> > if (!ss->early_init)
> > cgroup_init_subsys(ss);
> > + if (ss->use_id)
> > + cgroup_subsys_init_idr(ss);
> > }
> >
> > /* Add init_css_set to the hash table */
> > @@ -3231,3 +3242,260 @@ static int __init cgroup_disable(char *s
> > return 1;
> > }
> > __setup("cgroup_disable=", cgroup_disable);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/