/* Call callback function against all cgroup under hierarchy tree.  */
static int mem_cgroup_walk_tree(struct mem_cgroup *root, void *data, int(*func)(struct mem_cgroup *, void *))
/* Call callback function against all cgroup under hierarchy tree.  */
static int mem_cgroup_walk_tree(struct mem_cgroup *root, void *data, int(*func)(struct mem_cgroup *, void *))
{
	int found, ret, nextid;
	struct cgroup_subsys_state *css;
	struct mem_cgroup *mem;
	if (!root->use_hierarchy)
		return (*func)(root, data);
	nextid = 1;
	do {
		ret = 0;
		mem = NULL;
		rcu_read_lock();
		css = css_get_next(&mem_cgroup_subsys, nextid, &root->css,
				   &found);
		if (css && css_tryget(css))
			mem = container_of(css, struct mem_cgroup, css);
		rcu_read_unlock();
		if (mem) {
			ret = (*func)(mem, data);
			css_put(&mem->css);
		}
		nextid = found + 1;
	} while (!ret && css);
	return ret;
}