On Tue 13-11-12 16:30:36, Michal Hocko wrote: [...] > + /* > + * Root is not visited by cgroup iterators so it needs a special > + * treatment. > + */ > + if (!last_visited) { > + css = &root->css; > + } else { > + struct cgroup *next_cgroup; > + > + next_cgroup = cgroup_next_descendant_pre( > + last_visited->css.cgroup, > + root->css.cgroup); > + if (next_cgroup) > + css = cgroup_subsys_state(next_cgroup, > + mem_cgroup_subsys_id); This is not correct because cgroup_next_descendant_pre expects pos to be NULL for the first iteration but the way we do iterate (visit the root first) means that the second iteration will have last_visited != NULL and if root doesn't have any children the iteration would go unleashed to to the endless loop. We need something like: struct cgroup *prev_cgroup = (last_visited == root) ? NULL : last_visited->css.cgroup; next_cgroup = cgroup_next_descendant_pre(prev_cgroup, root->css.gtoup); -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>