public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Satoru Takeuchi <satoru.takeuchi@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] cgroup: change the limit of CGROUP_SUBSYS_COUNT depending on the size of the corresponding bitmasks
Date: Wed, 29 Mar 2017 08:59:50 +0900	[thread overview]
Message-ID: <87bmsluf49.wl-satoru.takeuchi@gmail.com> (raw)

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

                 reply	other threads:[~2017-03-29  0:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmsluf49.wl-satoru.takeuchi@gmail.com \
    --to=satoru.takeuchi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox