cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH cgroup/for-3.12-fixes] cgroup: fix cgroup post-order descendant walk of empty subtree
@ 2013-09-06 19:31 Tejun Heo
       [not found] ` <20130906193108.GH22763-9pTldWuhBndy/B6EtB590w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2013-09-06 19:31 UTC (permalink / raw)
  To: Li Zefan
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	cgroups-u79uwXL29TY76Z2rM5mHXA

bd8815a6d8 ("cgroup: make css_for_each_descendant() and friends
include the origin css in the iteration") updated cgroup descendant
iterators to include the origin css; unfortuantely, it forgot to drop
special case handling in css_next_descendant_post() for empty subtree
leading to failure to visit the origin css without any child.

Fix it by dropping the special case handling and always returning the
leftmost descendant on the first iteration.

Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 kernel/cgroup.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e0aeb32..8075b72 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3187,11 +3187,9 @@ css_next_descendant_post(struct cgroup_subsys_state *pos,
 
 	WARN_ON_ONCE(!rcu_read_lock_held());
 
-	/* if first iteration, visit the leftmost descendant */
-	if (!pos) {
-		next = css_leftmost_descendant(root);
-		return next != root ? next : NULL;
-	}
+	/* if first iteration, visit leftmost descendant which may be @root */
+	if (!pos)
+		return css_leftmost_descendant(root);
 
 	/* if we visited @root, we're done */
 	if (pos == root)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH cgroup/for-3.12-fixes] cgroup: fix cgroup post-order descendant walk of empty subtree
       [not found] ` <20130906193108.GH22763-9pTldWuhBndy/B6EtB590w@public.gmane.org>
@ 2013-09-10  9:19   ` Li Zefan
  2013-09-10 13:41   ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Li Zefan @ 2013-09-10  9:19 UTC (permalink / raw)
  To: Tejun Heo
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	cgroups-u79uwXL29TY76Z2rM5mHXA

On 2013/9/7 3:31, Tejun Heo wrote:
> bd8815a6d8 ("cgroup: make css_for_each_descendant() and friends
> include the origin css in the iteration") updated cgroup descendant
> iterators to include the origin css; unfortuantely, it forgot to drop
> special case handling in css_next_descendant_post() for empty subtree
> leading to failure to visit the origin css without any child.
> 
> Fix it by dropping the special case handling and always returning the
> leftmost descendant on the first iteration.
> 
> Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH cgroup/for-3.12-fixes] cgroup: fix cgroup post-order descendant walk of empty subtree
       [not found] ` <20130906193108.GH22763-9pTldWuhBndy/B6EtB590w@public.gmane.org>
  2013-09-10  9:19   ` Li Zefan
@ 2013-09-10 13:41   ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2013-09-10 13:41 UTC (permalink / raw)
  To: Li Zefan
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	cgroups-u79uwXL29TY76Z2rM5mHXA

On Fri, Sep 06, 2013 at 03:31:08PM -0400, Tejun Heo wrote:
> bd8815a6d8 ("cgroup: make css_for_each_descendant() and friends
> include the origin css in the iteration") updated cgroup descendant
> iterators to include the origin css; unfortuantely, it forgot to drop
> special case handling in css_next_descendant_post() for empty subtree
> leading to failure to visit the origin css without any child.
> 
> Fix it by dropping the special case handling and always returning the
> leftmost descendant on the first iteration.
> 
> Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Applied to cgroup/for-3.12-fixes.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-10 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06 19:31 [PATCH cgroup/for-3.12-fixes] cgroup: fix cgroup post-order descendant walk of empty subtree Tejun Heo
     [not found] ` <20130906193108.GH22763-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-09-10  9:19   ` Li Zefan
2013-09-10 13:41   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).