Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cgroup: increase maximum subsystem count from 16 to 32

The current cgroup subsystem limit of 16 is insufficient, as the number of
existing subsystems has already reached this limit. When adding a new
subsystem that is not yet in the mainline kernel, building with
`make allmodconfig` requires first bypassing the
`BUILD_BUG_ON(CGROUP_SUBSYS_COUNT > 16)` restriction to allow compilation
to succeed. However, the kernel still fails to boot afterward.

This patch increases the maximum number of supported cgroup subsystems from
16 to 32, providing enough room for future subsystem additions.

Signed-off-by: Chen Ridong <chenridong@huawei.com>
Acked-by: Waiman Long <longman@redhat.com>
Tested-by: JP Kobryn <inwardvessel@gmail.com>
Acked-by: JP Kobryn <inwardvessel@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Chen Ridong and committed by
Tejun Heo
5eab8c58 0ff6402d

+39 -39
+4 -4
include/linux/cgroup-defs.h
··· 535 535 * one which may have more subsystems enabled. Controller knobs 536 536 * are made available iff it's enabled in ->subtree_control. 537 537 */ 538 - u16 subtree_control; 539 - u16 subtree_ss_mask; 540 - u16 old_subtree_control; 541 - u16 old_subtree_ss_mask; 538 + u32 subtree_control; 539 + u32 subtree_ss_mask; 540 + u32 old_subtree_control; 541 + u32 old_subtree_ss_mask; 542 542 543 543 /* Private pointers for each registered subsystem */ 544 544 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT];
+1 -1
include/trace/events/cgroup.h
··· 16 16 17 17 TP_STRUCT__entry( 18 18 __field( int, root ) 19 - __field( u16, ss_mask ) 19 + __field( u32, ss_mask ) 20 20 __string( name, root->name ) 21 21 ), 22 22
+4 -4
kernel/cgroup/cgroup-internal.h
··· 52 52 bool cpuset_clone_children; 53 53 bool none; /* User explicitly requested empty subsystem */ 54 54 bool all_ss; /* Seen 'all' option */ 55 - u16 subsys_mask; /* Selected subsystems */ 55 + u32 subsys_mask; /* Selected subsystems */ 56 56 char *name; /* Hierarchy name */ 57 57 char *release_agent; /* Path for release notifications */ 58 58 }; ··· 146 146 struct cgroup_taskset tset; 147 147 148 148 /* subsystems affected by migration */ 149 - u16 ss_mask; 149 + u32 ss_mask; 150 150 }; 151 151 152 152 #define CGROUP_TASKSET_INIT(tset) \ ··· 235 235 void cgroup_favor_dynmods(struct cgroup_root *root, bool favor); 236 236 void cgroup_free_root(struct cgroup_root *root); 237 237 void init_cgroup_root(struct cgroup_fs_context *ctx); 238 - int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask); 239 - int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask); 238 + int cgroup_setup_root(struct cgroup_root *root, u32 ss_mask); 239 + int rebind_subsystems(struct cgroup_root *dst_root, u32 ss_mask); 240 240 int cgroup_do_get_tree(struct fs_context *fc); 241 241 242 242 int cgroup_migrate_vet_dst(struct cgroup *dst_cgrp);
+6 -6
kernel/cgroup/cgroup-v1.c
··· 28 28 #define CGROUP_PIDLIST_DESTROY_DELAY HZ 29 29 30 30 /* Controllers blocked by the commandline in v1 */ 31 - static u16 cgroup_no_v1_mask; 31 + static u32 cgroup_no_v1_mask; 32 32 33 33 /* disable named v1 mounts */ 34 34 static bool cgroup_no_v1_named; ··· 1037 1037 static int check_cgroupfs_options(struct fs_context *fc) 1038 1038 { 1039 1039 struct cgroup_fs_context *ctx = cgroup_fc2context(fc); 1040 - u16 mask = U16_MAX; 1041 - u16 enabled = 0; 1040 + u32 mask = U32_MAX; 1041 + u32 enabled = 0; 1042 1042 struct cgroup_subsys *ss; 1043 1043 int i; 1044 1044 1045 1045 #ifdef CONFIG_CPUSETS 1046 - mask = ~((u16)1 << cpuset_cgrp_id); 1046 + mask = ~((u32)1 << cpuset_cgrp_id); 1047 1047 #endif 1048 1048 for_each_subsys(ss, i) 1049 1049 if (cgroup_ssid_enabled(i) && !cgroup1_ssid_disabled(i) && ··· 1095 1095 struct kernfs_root *kf_root = kernfs_root_from_sb(fc->root->d_sb); 1096 1096 struct cgroup_root *root = cgroup_root_from_kf(kf_root); 1097 1097 int ret = 0; 1098 - u16 added_mask, removed_mask; 1098 + u32 added_mask, removed_mask; 1099 1099 1100 1100 cgroup_lock_and_drain_offline(&cgrp_dfl_root.cgrp); 1101 1101 ··· 1343 1343 continue; 1344 1344 1345 1345 if (!strcmp(token, "all")) { 1346 - cgroup_no_v1_mask = U16_MAX; 1346 + cgroup_no_v1_mask = U32_MAX; 1347 1347 continue; 1348 1348 } 1349 1349
+23 -23
kernel/cgroup/cgroup.c
··· 206 206 bool cgrp_dfl_visible; 207 207 208 208 /* some controllers are not supported in the default hierarchy */ 209 - static u16 cgrp_dfl_inhibit_ss_mask; 209 + static u32 cgrp_dfl_inhibit_ss_mask; 210 210 211 211 /* some controllers are implicitly enabled on the default hierarchy */ 212 - static u16 cgrp_dfl_implicit_ss_mask; 212 + static u32 cgrp_dfl_implicit_ss_mask; 213 213 214 214 /* some controllers can be threaded on the default hierarchy */ 215 - static u16 cgrp_dfl_threaded_ss_mask; 215 + static u32 cgrp_dfl_threaded_ss_mask; 216 216 217 217 /* The list of hierarchy roots */ 218 218 LIST_HEAD(cgroup_roots); ··· 234 234 * These bitmasks identify subsystems with specific features to avoid 235 235 * having to do iterative checks repeatedly. 236 236 */ 237 - static u16 have_fork_callback __read_mostly; 238 - static u16 have_exit_callback __read_mostly; 239 - static u16 have_release_callback __read_mostly; 240 - static u16 have_canfork_callback __read_mostly; 237 + static u32 have_fork_callback __read_mostly; 238 + static u32 have_exit_callback __read_mostly; 239 + static u32 have_release_callback __read_mostly; 240 + static u32 have_canfork_callback __read_mostly; 241 241 242 242 static bool have_favordynmods __ro_after_init = IS_ENABLED(CONFIG_CGROUP_FAVOR_DYNMODS); 243 243 ··· 475 475 } 476 476 477 477 /* subsystems visibly enabled on a cgroup */ 478 - static u16 cgroup_control(struct cgroup *cgrp) 478 + static u32 cgroup_control(struct cgroup *cgrp) 479 479 { 480 480 struct cgroup *parent = cgroup_parent(cgrp); 481 - u16 root_ss_mask = cgrp->root->subsys_mask; 481 + u32 root_ss_mask = cgrp->root->subsys_mask; 482 482 483 483 if (parent) { 484 - u16 ss_mask = parent->subtree_control; 484 + u32 ss_mask = parent->subtree_control; 485 485 486 486 /* threaded cgroups can only have threaded controllers */ 487 487 if (cgroup_is_threaded(cgrp)) ··· 496 496 } 497 497 498 498 /* subsystems enabled on a cgroup */ 499 - static u16 cgroup_ss_mask(struct cgroup *cgrp) 499 + static u32 cgroup_ss_mask(struct cgroup *cgrp) 500 500 { 501 501 struct cgroup *parent = cgroup_parent(cgrp); 502 502 503 503 if (parent) { 504 - u16 ss_mask = parent->subtree_ss_mask; 504 + u32 ss_mask = parent->subtree_ss_mask; 505 505 506 506 /* threaded cgroups can only have threaded controllers */ 507 507 if (cgroup_is_threaded(cgrp)) ··· 1636 1636 * This function calculates which subsystems need to be enabled if 1637 1637 * @subtree_control is to be applied while restricted to @this_ss_mask. 1638 1638 */ 1639 - static u16 cgroup_calc_subtree_ss_mask(u16 subtree_control, u16 this_ss_mask) 1639 + static u32 cgroup_calc_subtree_ss_mask(u32 subtree_control, u32 this_ss_mask) 1640 1640 { 1641 - u16 cur_ss_mask = subtree_control; 1641 + u32 cur_ss_mask = subtree_control; 1642 1642 struct cgroup_subsys *ss; 1643 1643 int ssid; 1644 1644 ··· 1647 1647 cur_ss_mask |= cgrp_dfl_implicit_ss_mask; 1648 1648 1649 1649 while (true) { 1650 - u16 new_ss_mask = cur_ss_mask; 1650 + u32 new_ss_mask = cur_ss_mask; 1651 1651 1652 1652 do_each_subsys_mask(ss, ssid, cur_ss_mask) { 1653 1653 new_ss_mask |= ss->depends_on; ··· 1851 1851 return ret; 1852 1852 } 1853 1853 1854 - int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask) 1854 + int rebind_subsystems(struct cgroup_root *dst_root, u32 ss_mask) 1855 1855 { 1856 1856 struct cgroup *dcgrp = &dst_root->cgrp; 1857 1857 struct cgroup_subsys *ss; 1858 1858 int ssid, ret; 1859 - u16 dfl_disable_ss_mask = 0; 1859 + u32 dfl_disable_ss_mask = 0; 1860 1860 1861 1861 lockdep_assert_held(&cgroup_mutex); 1862 1862 ··· 2152 2152 set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags); 2153 2153 } 2154 2154 2155 - int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask) 2155 + int cgroup_setup_root(struct cgroup_root *root, u32 ss_mask) 2156 2156 { 2157 2157 LIST_HEAD(tmp_links); 2158 2158 struct cgroup *root_cgrp = &root->cgrp; ··· 3134 3134 put_task_struct(task); 3135 3135 } 3136 3136 3137 - static void cgroup_print_ss_mask(struct seq_file *seq, u16 ss_mask) 3137 + static void cgroup_print_ss_mask(struct seq_file *seq, u32 ss_mask) 3138 3138 { 3139 3139 struct cgroup_subsys *ss; 3140 3140 bool printed = false; ··· 3499 3499 cgroup_apply_control_disable(cgrp); 3500 3500 } 3501 3501 3502 - static int cgroup_vet_subtree_control_enable(struct cgroup *cgrp, u16 enable) 3502 + static int cgroup_vet_subtree_control_enable(struct cgroup *cgrp, u32 enable) 3503 3503 { 3504 - u16 domain_enable = enable & ~cgrp_dfl_threaded_ss_mask; 3504 + u32 domain_enable = enable & ~cgrp_dfl_threaded_ss_mask; 3505 3505 3506 3506 /* if nothing is getting enabled, nothing to worry about */ 3507 3507 if (!enable) ··· 3544 3544 char *buf, size_t nbytes, 3545 3545 loff_t off) 3546 3546 { 3547 - u16 enable = 0, disable = 0; 3547 + u32 enable = 0, disable = 0; 3548 3548 struct cgroup *cgrp, *child; 3549 3549 struct cgroup_subsys *ss; 3550 3550 char *tok; ··· 6350 6350 struct cgroup_subsys *ss; 6351 6351 int ssid; 6352 6352 6353 - BUILD_BUG_ON(CGROUP_SUBSYS_COUNT > 16); 6353 + BUILD_BUG_ON(CGROUP_SUBSYS_COUNT > 32); 6354 6354 BUG_ON(cgroup_init_cftypes(NULL, cgroup_base_files)); 6355 6355 BUG_ON(cgroup_init_cftypes(NULL, cgroup_psi_files)); 6356 6356 BUG_ON(cgroup_init_cftypes(NULL, cgroup1_base_files));
+1 -1
kernel/cgroup/debug.c
··· 230 230 } 231 231 232 232 static void cgroup_masks_read_one(struct seq_file *seq, const char *name, 233 - u16 mask) 233 + u32 mask) 234 234 { 235 235 struct cgroup_subsys *ss; 236 236 int ssid;