Skip to content

Commit 265792d

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup: Skip subtree root in cgroup_update_dfl_csses()
The cgroup_update_dfl_csses() function updates css associations when a cgroup's subtree_control file is modified. Any changes made to a cgroup's subtree_control file, however, will only affect its descendants but not the cgroup itself. So there is no point in migrating csses associated with that cgroup. We can skip them instead. Signed-off-by: Waiman Long <longman@redhat.com> Reviewed-by: Michal Koutný <mkoutny@suse.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent c808f46 commit 265792d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kernel/cgroup/cgroup.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,6 +2971,15 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
29712971
cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) {
29722972
struct cgrp_cset_link *link;
29732973

2974+
/*
2975+
* As cgroup_update_dfl_csses() is only called by
2976+
* cgroup_apply_control(). The csses associated with the
2977+
* given cgrp will not be affected by changes made to
2978+
* its subtree_control file. We can skip them.
2979+
*/
2980+
if (dsct == cgrp)
2981+
continue;
2982+
29742983
list_for_each_entry(link, &dsct->cset_links, cset_link)
29752984
cgroup_migrate_add_src(link->cset, dsct, &mgctx);
29762985
}

0 commit comments

Comments
 (0)