diff options
| author | Tejun Heo <tj@kernel.org> | 2016-02-22 22:25:46 -0500 |
|---|---|---|
| committer | Michael Bestas <mkbestas@lineageos.org> | 2022-04-19 00:50:52 +0300 |
| commit | 7b66ea74a7394ff06cae31735d5ca469dc09dee2 (patch) | |
| tree | ffa5b8ff7e5f1f9755bdd4eaabd36997b49659c1 /kernel | |
| parent | 3cf23fe298f065ede2e43c46ffc76df000c7663a (diff) | |
cgroup: use do_each_subsys_mask() where applicable
There are several places in cgroup_subtree_control_write() which can
use do_each_subsys_mask() instead of manual mask testing. Use it.
No functional changes.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Chatur27 <jasonbright2709@gmail.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/cgroup.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index a44a3f3e2b83..06fc9077ac72 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -3194,10 +3194,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, * dependency. An invisible css is made visible when the userland * explicitly enables it. */ - for_each_subsys(ss, ssid) { - if (!(enable & (1 << ssid))) - continue; - + do_each_subsys_mask(ss, ssid, enable) { cgroup_for_each_live_child(child, cgrp) { if (css_enable & (1 << ssid)) ret = create_css(child, ss, @@ -3208,7 +3205,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, if (ret) goto err_undo_css; } - } + } while_each_subsys_mask(); /* * At this point, cgroup_e_css() results reflect the new csses @@ -3227,10 +3224,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, * state if it's made visible again later. Controllers which may * be depended upon should provide ->css_reset() for this purpose. */ - for_each_subsys(ss, ssid) { - if (!(disable & (1 << ssid))) - continue; - + do_each_subsys_mask(ss, ssid, disable) { cgroup_for_each_live_child(child, cgrp) { struct cgroup_subsys_state *css = cgroup_css(child, ss); @@ -3242,7 +3236,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, ss->css_reset(css); } } - } + } while_each_subsys_mask(); kernfs_activate(cgrp->kn); ret = 0; @@ -3254,10 +3248,7 @@ err_undo_css: cgrp->subtree_control = old_sc; cgrp->subtree_ss_mask = old_ss; - for_each_subsys(ss, ssid) { - if (!(enable & (1 << ssid))) - continue; - + do_each_subsys_mask(ss, ssid, enable) { cgroup_for_each_live_child(child, cgrp) { struct cgroup_subsys_state *css = cgroup_css(child, ss); @@ -3269,7 +3260,7 @@ err_undo_css: else css_clear_dir(css, NULL); } - } + } while_each_subsys_mask(); goto out_unlock; } @@ -5097,14 +5088,12 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, goto out_destroy; /* let's create and online css's */ - for_each_subsys(ss, ssid) { - if (parent->subtree_ss_mask & (1 << ssid)) { - ret = create_css(cgrp, ss, - parent->subtree_control & (1 << ssid)); - if (ret) - goto out_destroy; - } - } + do_each_subsys_mask(ss, ssid, parent->subtree_ss_mask) { + ret = create_css(cgrp, ss, + parent->subtree_control & (1 << ssid)); + if (ret) + goto out_destroy; + } while_each_subsys_mask(); /* * On the default hierarchy, a child doesn't automatically inherit |
