Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932851AbdC2ADD (ORCPT ); Tue, 28 Mar 2017 20:03:03 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33082 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932088AbdC2ADB (ORCPT ); Tue, 28 Mar 2017 20:03:01 -0400 Date: Wed, 29 Mar 2017 08:59:50 +0900 Message-ID: <87bmsluf49.wl-satoru.takeuchi@gmail.com> From: Satoru Takeuchi To: linux-kernel@vger.kernel.org Subject: [PATCH] cgroup: change the limit of CGROUP_SUBSYS_COUNT depending on the size of the corresponding bitmasks User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/25.1 Mule/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1069 Lines: 30 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 --- 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