Commit 8699b776 authored by Tejun Heo's avatar Tejun Heo

cgroup: s/child_subsys_mask/subtree_ss_mask/

For consistency with cgroup->subtree_control.

* cgroup->child_subsys_mask -> cgroup->subtree_ss_mask
* cgroup_calc_child_subsys_mask() -> cgroup_calc_subtree_ss_mask()
* cgroup_refresh_child_subsys_mask() -> cgroup_refresh_subtree_ss_mask()

No functional changes.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
parent 5eb385cc
...@@ -253,13 +253,12 @@ struct cgroup { ...@@ -253,13 +253,12 @@ struct cgroup {
/* /*
* The bitmask of subsystems enabled on the child cgroups. * The bitmask of subsystems enabled on the child cgroups.
* ->subtree_control is the one configured through * ->subtree_control is the one configured through
* "cgroup.subtree_control" while ->child_subsys_mask is the * "cgroup.subtree_control" while ->child_ss_mask is the effective
* effective one which may have more subsystems enabled. * one which may have more subsystems enabled. Controller knobs
* Controller knobs are made available iff it's enabled in * are made available iff it's enabled in ->subtree_control.
* ->subtree_control.
*/ */
unsigned int subtree_control; unsigned long subtree_control;
unsigned int child_subsys_mask; unsigned long subtree_ss_mask;
/* Private pointers for each registered subsystem */ /* Private pointers for each registered subsystem */
struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT]; struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT];
......
...@@ -391,10 +391,10 @@ static struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp, ...@@ -391,10 +391,10 @@ static struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp,
/* /*
* This function is used while updating css associations and thus * This function is used while updating css associations and thus
* can't test the csses directly. Use ->child_subsys_mask. * can't test the csses directly. Use ->subtree_ss_mask.
*/ */
while (cgroup_parent(cgrp) && while (cgroup_parent(cgrp) &&
!(cgroup_parent(cgrp)->child_subsys_mask & (1 << ss->id))) !(cgroup_parent(cgrp)->subtree_ss_mask & (1 << ss->id)))
cgrp = cgroup_parent(cgrp); cgrp = cgroup_parent(cgrp);
return cgroup_css(cgrp, ss); return cgroup_css(cgrp, ss);
...@@ -1256,7 +1256,7 @@ static umode_t cgroup_file_mode(const struct cftype *cft) ...@@ -1256,7 +1256,7 @@ static umode_t cgroup_file_mode(const struct cftype *cft)
} }
/** /**
* cgroup_calc_child_subsys_mask - calculate child_subsys_mask * cgroup_calc_subtree_ss_mask - calculate subtree_ss_mask
* @cgrp: the target cgroup * @cgrp: the target cgroup
* @subtree_control: the new subtree_control mask to consider * @subtree_control: the new subtree_control mask to consider
* *
...@@ -1268,7 +1268,7 @@ static umode_t cgroup_file_mode(const struct cftype *cft) ...@@ -1268,7 +1268,7 @@ static umode_t cgroup_file_mode(const struct cftype *cft)
* @subtree_control is to be applied to @cgrp. The returned mask is always * @subtree_control is to be applied to @cgrp. The returned mask is always
* a superset of @subtree_control and follows the usual hierarchy rules. * a superset of @subtree_control and follows the usual hierarchy rules.
*/ */
static unsigned long cgroup_calc_child_subsys_mask(struct cgroup *cgrp, static unsigned long cgroup_calc_subtree_ss_mask(struct cgroup *cgrp,
unsigned long subtree_control) unsigned long subtree_control)
{ {
struct cgroup *parent = cgroup_parent(cgrp); struct cgroup *parent = cgroup_parent(cgrp);
...@@ -1293,7 +1293,7 @@ static unsigned long cgroup_calc_child_subsys_mask(struct cgroup *cgrp, ...@@ -1293,7 +1293,7 @@ static unsigned long cgroup_calc_child_subsys_mask(struct cgroup *cgrp,
* to non-default hierarchies. * to non-default hierarchies.
*/ */
if (parent) if (parent)
new_ss_mask &= parent->child_subsys_mask; new_ss_mask &= parent->subtree_ss_mask;
else else
new_ss_mask &= cgrp->root->subsys_mask; new_ss_mask &= cgrp->root->subsys_mask;
...@@ -1306,16 +1306,16 @@ static unsigned long cgroup_calc_child_subsys_mask(struct cgroup *cgrp, ...@@ -1306,16 +1306,16 @@ static unsigned long cgroup_calc_child_subsys_mask(struct cgroup *cgrp,
} }
/** /**
* cgroup_refresh_child_subsys_mask - update child_subsys_mask * cgroup_refresh_subtree_ss_mask - update subtree_ss_mask
* @cgrp: the target cgroup * @cgrp: the target cgroup
* *
* Update @cgrp->child_subsys_mask according to the current * Update @cgrp->subtree_ss_mask according to the current
* @cgrp->subtree_control using cgroup_calc_child_subsys_mask(). * @cgrp->subtree_control using cgroup_calc_subtree_ss_mask().
*/ */
static void cgroup_refresh_child_subsys_mask(struct cgroup *cgrp) static void cgroup_refresh_subtree_ss_mask(struct cgroup *cgrp)
{ {
cgrp->child_subsys_mask = cgrp->subtree_ss_mask =
cgroup_calc_child_subsys_mask(cgrp, cgrp->subtree_control); cgroup_calc_subtree_ss_mask(cgrp, cgrp->subtree_control);
} }
/** /**
...@@ -1542,7 +1542,7 @@ static int rebind_subsystems(struct cgroup_root *dst_root, ...@@ -1542,7 +1542,7 @@ static int rebind_subsystems(struct cgroup_root *dst_root,
src_root->subsys_mask &= ~(1 << ssid); src_root->subsys_mask &= ~(1 << ssid);
scgrp->subtree_control &= ~(1 << ssid); scgrp->subtree_control &= ~(1 << ssid);
cgroup_refresh_child_subsys_mask(scgrp); cgroup_refresh_subtree_ss_mask(scgrp);
/* default hierarchy doesn't enable controllers by default */ /* default hierarchy doesn't enable controllers by default */
dst_root->subsys_mask |= 1 << ssid; dst_root->subsys_mask |= 1 << ssid;
...@@ -1550,7 +1550,7 @@ static int rebind_subsystems(struct cgroup_root *dst_root, ...@@ -1550,7 +1550,7 @@ static int rebind_subsystems(struct cgroup_root *dst_root,
static_branch_enable(cgroup_subsys_on_dfl_key[ssid]); static_branch_enable(cgroup_subsys_on_dfl_key[ssid]);
} else { } else {
dcgrp->subtree_control |= 1 << ssid; dcgrp->subtree_control |= 1 << ssid;
cgroup_refresh_child_subsys_mask(dcgrp); cgroup_refresh_subtree_ss_mask(dcgrp);
static_branch_disable(cgroup_subsys_on_dfl_key[ssid]); static_branch_disable(cgroup_subsys_on_dfl_key[ssid]);
} }
...@@ -2523,11 +2523,11 @@ static int cgroup_migrate_prepare_dst(struct cgroup *dst_cgrp, ...@@ -2523,11 +2523,11 @@ static int cgroup_migrate_prepare_dst(struct cgroup *dst_cgrp,
lockdep_assert_held(&cgroup_mutex); lockdep_assert_held(&cgroup_mutex);
/* /*
* Except for the root, child_subsys_mask must be zero for a cgroup * Except for the root, subtree_ss_mask must be zero for a cgroup
* with tasks so that child cgroups don't compete against tasks. * with tasks so that child cgroups don't compete against tasks.
*/ */
if (dst_cgrp && cgroup_on_dfl(dst_cgrp) && cgroup_parent(dst_cgrp) && if (dst_cgrp && cgroup_on_dfl(dst_cgrp) && cgroup_parent(dst_cgrp) &&
dst_cgrp->child_subsys_mask) dst_cgrp->subtree_ss_mask)
return -EBUSY; return -EBUSY;
/* look up the dst cset for each src cset and link it to src */ /* look up the dst cset for each src cset and link it to src */
...@@ -2880,7 +2880,7 @@ static int cgroup_subtree_control_show(struct seq_file *seq, void *v) ...@@ -2880,7 +2880,7 @@ static int cgroup_subtree_control_show(struct seq_file *seq, void *v)
* cgroup_update_dfl_csses - update css assoc of a subtree in default hierarchy * cgroup_update_dfl_csses - update css assoc of a subtree in default hierarchy
* @cgrp: root of the subtree to update csses for * @cgrp: root of the subtree to update csses for
* *
* @cgrp's child_subsys_mask has changed and its subtree's (self excluded) * @cgrp's subtree_ss_mask has changed and its subtree's (self excluded)
* css associations need to be updated accordingly. This function looks up * css associations need to be updated accordingly. This function looks up
* all css_sets which are attached to the subtree, creates the matching * all css_sets which are attached to the subtree, creates the matching
* updated css_sets and migrates the tasks to the new ones. * updated css_sets and migrates the tasks to the new ones.
...@@ -2902,7 +2902,7 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp) ...@@ -2902,7 +2902,7 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
css_for_each_descendant_pre(css, cgroup_css(cgrp, NULL)) { css_for_each_descendant_pre(css, cgroup_css(cgrp, NULL)) {
struct cgrp_cset_link *link; struct cgrp_cset_link *link;
/* self is not affected by child_subsys_mask change */ /* self is not affected by subtree_ss_mask change */
if (css->cgroup == cgrp) if (css->cgroup == cgrp)
continue; continue;
...@@ -3034,9 +3034,9 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, ...@@ -3034,9 +3034,9 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
* depending on subsystem dependencies. * depending on subsystem dependencies.
*/ */
old_sc = cgrp->subtree_control; old_sc = cgrp->subtree_control;
old_ss = cgrp->child_subsys_mask; old_ss = cgrp->subtree_ss_mask;
new_sc = (old_sc | enable) & ~disable; new_sc = (old_sc | enable) & ~disable;
new_ss = cgroup_calc_child_subsys_mask(cgrp, new_sc); new_ss = cgroup_calc_subtree_ss_mask(cgrp, new_sc);
css_enable = ~old_ss & new_ss; css_enable = ~old_ss & new_ss;
css_disable = old_ss & ~new_ss; css_disable = old_ss & ~new_ss;
...@@ -3069,7 +3069,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, ...@@ -3069,7 +3069,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
} }
cgrp->subtree_control = new_sc; cgrp->subtree_control = new_sc;
cgrp->child_subsys_mask = new_ss; cgrp->subtree_ss_mask = new_ss;
/* /*
* Create new csses or make the existing ones visible. A css is * Create new csses or make the existing ones visible. A css is
...@@ -3135,7 +3135,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, ...@@ -3135,7 +3135,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
err_undo_css: err_undo_css:
cgrp->subtree_control = old_sc; cgrp->subtree_control = old_sc;
cgrp->child_subsys_mask = old_ss; cgrp->subtree_ss_mask = old_ss;
for_each_subsys(ss, ssid) { for_each_subsys(ss, ssid) {
if (!(enable & (1 << ssid))) if (!(enable & (1 << ssid)))
...@@ -4969,7 +4969,7 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, ...@@ -4969,7 +4969,7 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name,
/* let's create and online css's */ /* let's create and online css's */
for_each_subsys(ss, ssid) { for_each_subsys(ss, ssid) {
if (parent->child_subsys_mask & (1 << ssid)) { if (parent->subtree_ss_mask & (1 << ssid)) {
ret = create_css(cgrp, ss, ret = create_css(cgrp, ss,
parent->subtree_control & (1 << ssid)); parent->subtree_control & (1 << ssid));
if (ret) if (ret)
...@@ -4983,7 +4983,7 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, ...@@ -4983,7 +4983,7 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name,
*/ */
if (!cgroup_on_dfl(cgrp)) { if (!cgroup_on_dfl(cgrp)) {
cgrp->subtree_control = parent->subtree_control; cgrp->subtree_control = parent->subtree_control;
cgroup_refresh_child_subsys_mask(cgrp); cgroup_refresh_subtree_ss_mask(cgrp);
} }
kernfs_activate(kn); kernfs_activate(kn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment