Just for the record. I squash the following doc update to the patch in the next version. --- diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 811967a..9ca85ff 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -42,11 +42,19 @@ struct mem_cgroup_reclaim_cookie { }; enum mem_cgroup_filter_t { - VISIT, - SKIP, - SKIP_TREE, + VISIT, /* visit current node */ + SKIP, /* skip the current node and continue traversal */ + SKIP_TREE, /* skip the whole subtree and continue traversal */ }; +/* + * mem_cgroup_filter_t predicate might instruct mem_cgroup_iter_cond how to + * iterate through the hierarchy tree. Each tree element is checked by the + * predicate before it is returned by the iterator. If a filter returns + * SKIP or SKIP_TREE then the iterator code continues traversal (with the + * next node down the hierarchy or the next node that doesn't belong under the + * memcg's subtree). + */ typedef enum mem_cgroup_filter_t (*mem_cgroup_iter_filter)(struct mem_cgroup *memcg, struct mem_cgroup *root); diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 91740f7..43e955a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1073,6 +1073,14 @@ skip_node: prev_cgroup = next_cgroup; goto skip_node; case SKIP_TREE: + /* + * cgroup_rightmost_descendant is not an optimal way to + * skip through a subtree (especially for imbalanced + * trees leaning to right) but that's what we have right + * now. More effective solution would be traversing + * right-up for first non-NULL without calling + * cgroup_next_descendant_pre afterwards. + */ prev_cgroup = cgroup_rightmost_descendant(next_cgroup); goto skip_node; case VISIT: -- 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>