Skip to content

Commit 8ab456a

Browse files
cypharhtejun
authored andcommitted
cgroup: switch to unsigned long for bitmasks
Switch the type of all internal cgroup masks to (unsigned long), which is the correct type for bitmasks. This is in preparation for the for_each_subsys_which patch. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent c326aa2 commit 8ab456a

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

kernel/cgroup.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static bool cgrp_dfl_root_visible;
156156
static bool cgroup_legacy_files_on_dfl;
157157

158158
/* some controllers are not supported in the default hierarchy */
159-
static unsigned int cgrp_dfl_root_inhibit_ss_mask;
159+
static unsigned long cgrp_dfl_root_inhibit_ss_mask;
160160

161161
/* The list of hierarchy roots */
162162

@@ -186,7 +186,7 @@ static struct cftype cgroup_dfl_base_files[];
186186
static struct cftype cgroup_legacy_base_files[];
187187

188188
static int rebind_subsystems(struct cgroup_root *dst_root,
189-
unsigned int ss_mask);
189+
unsigned long ss_mask);
190190
static int cgroup_destroy_locked(struct cgroup *cgrp);
191191
static int create_css(struct cgroup *cgrp, struct cgroup_subsys *ss,
192192
bool visible);
@@ -998,7 +998,7 @@ static struct cgroup *task_cgroup_from_root(struct task_struct *task,
998998
* update of a tasks cgroup pointer by cgroup_attach_task()
999999
*/
10001000

1001-
static int cgroup_populate_dir(struct cgroup *cgrp, unsigned int subsys_mask);
1001+
static int cgroup_populate_dir(struct cgroup *cgrp, unsigned long subsys_mask);
10021002
static struct kernfs_syscall_ops cgroup_kf_syscall_ops;
10031003
static const struct file_operations proc_cgroupstats_operations;
10041004

@@ -1068,11 +1068,11 @@ static void cgroup_put(struct cgroup *cgrp)
10681068
* @subtree_control is to be applied to @cgrp. The returned mask is always
10691069
* a superset of @subtree_control and follows the usual hierarchy rules.
10701070
*/
1071-
static unsigned int cgroup_calc_child_subsys_mask(struct cgroup *cgrp,
1072-
unsigned int subtree_control)
1071+
static unsigned long cgroup_calc_child_subsys_mask(struct cgroup *cgrp,
1072+
unsigned long subtree_control)
10731073
{
10741074
struct cgroup *parent = cgroup_parent(cgrp);
1075-
unsigned int cur_ss_mask = subtree_control;
1075+
unsigned long cur_ss_mask = subtree_control;
10761076
struct cgroup_subsys *ss;
10771077
int ssid;
10781078

@@ -1082,7 +1082,7 @@ static unsigned int cgroup_calc_child_subsys_mask(struct cgroup *cgrp,
10821082
return cur_ss_mask;
10831083

10841084
while (true) {
1085-
unsigned int new_ss_mask = cur_ss_mask;
1085+
unsigned long new_ss_mask = cur_ss_mask;
10861086

10871087
for_each_subsys(ss, ssid)
10881088
if (cur_ss_mask & (1 << ssid))
@@ -1200,7 +1200,7 @@ static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft)
12001200
* @cgrp: target cgroup
12011201
* @subsys_mask: mask of the subsystem ids whose files should be removed
12021202
*/
1203-
static void cgroup_clear_dir(struct cgroup *cgrp, unsigned int subsys_mask)
1203+
static void cgroup_clear_dir(struct cgroup *cgrp, unsigned long subsys_mask)
12041204
{
12051205
struct cgroup_subsys *ss;
12061206
int i;
@@ -1215,10 +1215,11 @@ static void cgroup_clear_dir(struct cgroup *cgrp, unsigned int subsys_mask)
12151215
}
12161216
}
12171217

1218-
static int rebind_subsystems(struct cgroup_root *dst_root, unsigned int ss_mask)
1218+
static int rebind_subsystems(struct cgroup_root *dst_root,
1219+
unsigned long ss_mask)
12191220
{
12201221
struct cgroup_subsys *ss;
1221-
unsigned int tmp_ss_mask;
1222+
unsigned long tmp_ss_mask;
12221223
int ssid, i, ret;
12231224

12241225
lockdep_assert_held(&cgroup_mutex);
@@ -1253,7 +1254,7 @@ static int rebind_subsystems(struct cgroup_root *dst_root, unsigned int ss_mask)
12531254
* Just warn about it and continue.
12541255
*/
12551256
if (cgrp_dfl_root_visible) {
1256-
pr_warn("failed to create files (%d) while rebinding 0x%x to default root\n",
1257+
pr_warn("failed to create files (%d) while rebinding 0x%lx to default root\n",
12571258
ret, ss_mask);
12581259
pr_warn("you may retry by moving them to a different hierarchy and unbinding\n");
12591260
}
@@ -1338,7 +1339,7 @@ static int cgroup_show_options(struct seq_file *seq,
13381339
}
13391340

13401341
struct cgroup_sb_opts {
1341-
unsigned int subsys_mask;
1342+
unsigned long subsys_mask;
13421343
unsigned int flags;
13431344
char *release_agent;
13441345
bool cpuset_clone_children;
@@ -1351,7 +1352,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
13511352
{
13521353
char *token, *o = data;
13531354
bool all_ss = false, one_ss = false;
1354-
unsigned int mask = -1U;
1355+
unsigned long mask = -1UL;
13551356
struct cgroup_subsys *ss;
13561357
int nr_opts = 0;
13571358
int i;
@@ -1495,7 +1496,7 @@ static int cgroup_remount(struct kernfs_root *kf_root, int *flags, char *data)
14951496
int ret = 0;
14961497
struct cgroup_root *root = cgroup_root_from_kf(kf_root);
14971498
struct cgroup_sb_opts opts;
1498-
unsigned int added_mask, removed_mask;
1499+
unsigned long added_mask, removed_mask;
14991500

15001501
if (root == &cgrp_dfl_root) {
15011502
pr_err("remount is not allowed\n");
@@ -1641,7 +1642,7 @@ static void init_cgroup_root(struct cgroup_root *root,
16411642
set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags);
16421643
}
16431644

1644-
static int cgroup_setup_root(struct cgroup_root *root, unsigned int ss_mask)
1645+
static int cgroup_setup_root(struct cgroup_root *root, unsigned long ss_mask)
16451646
{
16461647
LIST_HEAD(tmp_links);
16471648
struct cgroup *root_cgrp = &root->cgrp;
@@ -2542,7 +2543,7 @@ static int cgroup_sane_behavior_show(struct seq_file *seq, void *v)
25422543
return 0;
25432544
}
25442545

2545-
static void cgroup_print_ss_mask(struct seq_file *seq, unsigned int ss_mask)
2546+
static void cgroup_print_ss_mask(struct seq_file *seq, unsigned long ss_mask)
25462547
{
25472548
struct cgroup_subsys *ss;
25482549
bool printed = false;
@@ -2689,8 +2690,8 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
26892690
char *buf, size_t nbytes,
26902691
loff_t off)
26912692
{
2692-
unsigned int enable = 0, disable = 0;
2693-
unsigned int css_enable, css_disable, old_sc, new_sc, old_ss, new_ss;
2693+
unsigned long enable = 0, disable = 0;
2694+
unsigned long css_enable, css_disable, old_sc, new_sc, old_ss, new_ss;
26942695
struct cgroup *cgrp, *child;
26952696
struct cgroup_subsys *ss;
26962697
char *tok;
@@ -4322,7 +4323,7 @@ static struct cftype cgroup_legacy_base_files[] = {
43224323
*
43234324
* On failure, no file is added.
43244325
*/
4325-
static int cgroup_populate_dir(struct cgroup *cgrp, unsigned int subsys_mask)
4326+
static int cgroup_populate_dir(struct cgroup *cgrp, unsigned long subsys_mask)
43264327
{
43274328
struct cgroup_subsys *ss;
43284329
int i, ret = 0;

0 commit comments

Comments
 (0)