[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121031163848.GC2945@htj.dyndns.org>
Date: Wed, 31 Oct 2012 09:38:48 -0700
From: Tejun Heo <tj@...nel.org>
To: Glauber Costa <glommer@...allels.com>
Cc: lizefan@...wei.com, hannes@...xchg.org, mhocko@...e.cz,
bsingharora@...il.com, kamezawa.hiroyu@...fujitsu.com,
cgroups@...r.kernel.org, containers@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/8] cgroup: kill
cgroup_subsys->__DEPRECATED_clear_css_refs
Hello, Glauber.
On Wed, Oct 31, 2012 at 05:21:29PM +0400, Glauber Costa wrote:
> > +
> > + local_irq_disable();
> > +
> > + /* block new css_tryget() by deactivating refcnt */
> > + for_each_subsys(cgrp->root, ss) {
> > + struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
> > +
> > + WARN_ON(atomic_read(&css->refcnt) < 0);
> > + atomic_add(CSS_DEACT_BIAS, &css->refcnt);
> > }
> > - /* NO css_tryget() can success after here. */
> > +
> > + /*
> > + * Set REMOVED. All in-progress css_tryget() will be released.
> > + * Put all the base refs. Each css holds an extra reference to the
> > + * cgroup's dentry and cgroup removal proceeds regardless of css
> > + * refs. On the last put of each css, whenever that may be, the
> > + * extra dentry ref is put so that dentry destruction happens only
> > + * after all css's are released.
> > + */
> > + for_each_subsys(cgrp->root, ss) {
> > + struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
> > +
> > + set_bit(CSS_REMOVED, &css->flags);
> > + css_put(css);
> > + }
> > +
> > + local_irq_enable();
> > +
> > finish_wait(&cgroup_rmdir_waitq, &wait);
>
> It seems to me that the main reason for doing this in two passes was to
> derive a global "failed" state on the first pass. Now that we can't
> fail, why can't you just loop through the subsystems just once ?
Later in the series, pre_destroy() happens inbetween. The first loop
marks the CSSes and cgrp dead, ->pre_destroy()s are called, and the
later loop will put the final ref. I'll mention it in the commit
message.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists