diff options
author | Tejun Heo <tj@kernel.org> | 2012-11-09 09:12:29 -0800 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-11-09 09:12:29 -0800 |
commit | 574bd9f7c7c1d32f52dea5488018a6ff79031e22 (patch) | |
tree | f43657afb59dd12fe1eca329acc6caf885507727 /kernel/padata.c | |
parent | eb6fd5040ee799009173daa49c3e7aa0362167c9 (diff) | |
download | linux-stable-574bd9f7c7c1d32f52dea5488018a6ff79031e22.tar.gz linux-stable-574bd9f7c7c1d32f52dea5488018a6ff79031e22.tar.bz2 linux-stable-574bd9f7c7c1d32f52dea5488018a6ff79031e22.zip |
cgroup: implement generic child / descendant walk macros
Currently, cgroup doesn't provide any generic helper for walking a
given cgroup's children or descendants. This patch adds the following
three macros.
* cgroup_for_each_child() - walk immediate children of a cgroup.
* cgroup_for_each_descendant_pre() - visit all descendants of a cgroup
in pre-order tree traversal.
* cgroup_for_each_descendant_post() - visit all descendants of a
cgroup in post-order tree traversal.
All three only require the user to hold RCU read lock during
traversal. Verifying that each iterated cgroup is online is the
responsibility of the user. When used with proper synchronization,
cgroup_for_each_descendant_pre() can be used to propagate state
updates to descendants in reliable way. See comments for details.
v2: s/config/state/ in commit message and comments per Michal. More
documentation on synchronization rules.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujisu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel/padata.c')
0 files changed, 0 insertions, 0 deletions