Re: [PATCH v5 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2012/9/13 15:50, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner@xxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxx>
> Acked-by: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Gao feng <gaofeng@xxxxxxxxxxxxxx>
> Cc: Jamal Hadi Salim <jhs@xxxxxxxxxxxx>
> Cc: John Fastabend <john.r.fastabend@xxxxxxxxx>
> Cc: Li Zefan <lizefan@xxxxxxxxxx>
> Cc: Neil Horman <nhorman@xxxxxxxxxxxxx>
> Cc: netdev@xxxxxxxxxxxxxxx
> Cc: cgroups@xxxxxxxxxxxxxxx
> ---
>  include/linux/cgroup.h |  2 +-
>  kernel/cgroup.c        | 68 +++++++++++++++++++++++++++++---------------------
>  2 files changed, 41 insertions(+), 29 deletions(-)
> 

Acked-by: Li Zefan <lizefan@xxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux