[PATCH 4/5] cgroup: update iterators to use cgroup_next_sibling()
Tejun Heo
tj at kernel.org
Wed May 22 09:17:42 UTC 2013
On Wed, May 22, 2013 at 05:09:02PM +0800, Li Zefan wrote:
> > @@ -3068,6 +3071,11 @@ EXPORT_SYMBOL_GPL(cgroup_next_descendant_pre);
> > * Return the rightmost descendant of @pos. If there's no descendant,
> > * @pos is returned. This can be used during pre-order traversal to skip
> > * subtree of @pos.
> > + *
> > + * While this function requires RCU read locking, it doesn't require the
> > + * whole traversal to be contained in a single RCU critical section. This
> > + * function will return the correct rightmost descendant as long as @pos is
> > + * accessible.
> > */
> > struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos)
> > {
>
> Forgot to convert cgroup_rightmost_descendat() to use cgroup_next_sibling()?
>
> do {
> last = pos;
> /* ->prev isn't RCU safe, walk ->next till the end */
> pos = NULL;
> list_for_each_entry_rcu(tmp, &last->children, sibling)
> pos = tmp;
> } while (pos);
It's always walking from the parent->children with RCU read locked, so
it doesn't need to be converted. We can still convert it for
consistency and I had that in the patch originally but dropped it as
the conversion seemed a bit misleading as it covers a case which can
never happen. Hmmm....
Thanks.
--
tejun
More information about the Containers
mailing list