[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <50519429.3090809@huawei.com>
Date: Thu, 13 Sep 2012 16:07:05 +0800
From: Li Zefan <lizefan@...wei.com>
To: Daniel Wagner <wagi@...om.org>
CC: <netdev@...r.kernel.org>,
Daniel Wagner <daniel.wagner@...-carit.de>,
Gao feng <gaofeng@...fujitsu.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
John Fastabend <john.r.fastabend@...el.com>,
Neil Horman <nhorman@...driver.com>, <cgroups@...r.kernel.org>
Subject: Re: [PATCH v5 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
On 2012/9/13 15:50, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner@...-carit.de>
>
> CGROUP_BUILTIN_SUBSYS_COUNT is used as start index or stop index when
> looping over the subsys array looking either at the builtin or the
> module subsystems. Since all the builtin subsystems have an id which
> is lower then CGROUP_BUILTIN_SUBSYS_COUNT we know that any module will
> have an id larger than CGROUP_BUILTIN_SUBSYS_COUNT. In short the ids
> are sorted.
>
> We are about to change id assignment to happen only at compile time
> later in this series. That means we can't rely on the above trick
> since all ids will always be defined at compile time. Furthermore,
> ordering the builtin subsystems and the module subsystems is not
> really necessary.
>
> So we need a different way to know which subsystem is a builtin or a
> module one. We can use the subsys[]->module pointer for this. Any
> place where we need to know if a subsys is module we just check for
> the pointer. If it is NULL then the subsystem is a builtin one.
>
> With this we are able to drop the CGROUP_BUILTIN_SUBSYS_COUNT
> enum. Though we need to introduce a temporary placeholder so that we
> don't get a compilation error when only CONFIG_CGROUP is selected and
> no single controller. An empty enum definition is not valid. Later in
> this series we are able to remove the placeholder again.
>
> And with this change we get a fix for this:
>
> kernel/cgroup.c: In function ‘cgroup_load_subsys’:
> kernel/cgroup.c:4326:38: warning: array subscript is below array bounds [-Warray-bounds]
>
> when CONFIG_CGROUP=y and no built in controller was enabled.
>
> Signed-off-by: Daniel Wagner <daniel.wagner@...-carit.de>
> Acked-by: Tejun Heo <tj@...nel.org>
> Cc: Gao feng <gaofeng@...fujitsu.com>
> Cc: Jamal Hadi Salim <jhs@...atatu.com>
> Cc: John Fastabend <john.r.fastabend@...el.com>
> Cc: Li Zefan <lizefan@...wei.com>
> Cc: Neil Horman <nhorman@...driver.com>
> Cc: netdev@...r.kernel.org
> Cc: cgroups@...r.kernel.org
> ---
> include/linux/cgroup.h | 2 +-
> kernel/cgroup.c | 68 +++++++++++++++++++++++++++++---------------------
> 2 files changed, 41 insertions(+), 29 deletions(-)
>
Acked-by: Li Zefan <lizefan@...wei.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists