Skip to contentSkip to conversation

cgroup: fix cgroup post-order descendant walk of empty subtree

PATCH In review Tejun Heo 2 participants 5 messages Sep 6, 2013 – Sep 10, 2013 1 message not in the archive cgroup

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 cgroup: fix cgroup post-order descendant walk of empty subtree

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.

---
 kernel/cgroup.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
kernel/cgroup.c +3 -5
index e0aeb32..8075b72 100644
@@ -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)

A message that is not in the archive (sent off-list or not yet received): 20130906193108.GH22763-9pTldWuhBndy/[email protected]

Acked-by
#2 lore raw
Quoted 10 lines · Tejun Heo

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.

Acked-by
#3 lore raw
In reply to a message not in the archive
Quoted 10 lines · Tejun Heo

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.

author Applied
#4 lore raw
In reply to a message not in the archive
Quoted 10 lines · Tejun Heo

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.

Applied to cgroup/for-3.12-fixes.

Thanks.

Signature · 1 line
tejun
author Applied
#5 lore raw
In reply to a message not in the archive
Quoted 10 lines · Tejun Heo

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.

Applied to cgroup/for-3.12-fixes.

Thanks.

Signature · 1 line
tejun