All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroup: change the limit of CGROUP_SUBSYS_COUNT depending on the size of the corresponding bitmasks
@ 2017-03-28 23:59 Satoru Takeuchi
  0 siblings, 0 replies; only message in thread
From: Satoru Takeuchi @ 2017-03-28 23:59 UTC (permalink / raw)
  To: linux-kernel

The limit of CGROUP_SUBSYS_COUNT is hardcoded to 16. This value comes from
the size of the corresponding bitmasks, u16. It's better to change this limit
depending on the size of the corresponding bitmasks because of the following
reasons.

- to avoid setting the wrong limit when the size of the corresponding bitmasks
  are changed
- to make the meaning of this limit clear

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
---
 kernel/cgroup/cgroup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 4885132..576b184 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4490,7 +4490,8 @@ int __init cgroup_init(void)
 	struct cgroup_subsys *ss;
 	int ssid;
 
-	BUILD_BUG_ON(CGROUP_SUBSYS_COUNT > 16);
+	BUILD_BUG_ON(CGROUP_SUBSYS_COUNT > (sizeof(cgroup_disable_mask) * __CHAR_BIT__));
+
 	BUG_ON(percpu_init_rwsem(&cgroup_threadgroup_rwsem));
 	BUG_ON(cgroup_init_cftypes(NULL, cgroup_base_files));
 	BUG_ON(cgroup_init_cftypes(NULL, cgroup1_base_files));
-- 
2.7.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-29  0:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 23:59 [PATCH] cgroup: change the limit of CGROUP_SUBSYS_COUNT depending on the size of the corresponding bitmasks Satoru Takeuchi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.