public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public•gmane.org>
To: Daniel Wagner <wagi-kQCPcA+X3s7YtjvyW6yDsg@public•gmane.org>
Cc: <netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org>,
	Daniel Wagner
	<daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public•gmane.org>,
	Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public•gmane.org>,
	Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public•gmane.org>,
	John Fastabend
	<john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public•gmane.org>,
	Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public•gmane.org>,
	<cgroups-u79uwXL29TY76Z2rM5mHXA@public•gmane.org>
Subject: Re: [PATCH v5 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
Date: Thu, 13 Sep 2012 16:07:05 +0800	[thread overview]
Message-ID: <50519429.3090809@huawei.com> (raw)
In-Reply-To: <1347522655-24158-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>

On 2012/9/13 15:50, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public•gmane.org>
> 
> 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-98C5kh4wR6ohFhg+JK9F0w@public•gmane.org>
> Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public•gmane.org>
> Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public•gmane.org>
> Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public•gmane.org>
> Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public•gmane.org>
> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public•gmane.org>
> Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public•gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
> ---
>  include/linux/cgroup.h |  2 +-
>  kernel/cgroup.c        | 68 +++++++++++++++++++++++++++++---------------------
>  2 files changed, 41 insertions(+), 29 deletions(-)
> 

Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public•gmane.org>

      parent reply	other threads:[~2012-09-13  8:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13  7:50 [PATCH v5 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT Daniel Wagner
     [not found] ` <1347522655-24158-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13  8:07   ` Li Zefan [this message]

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=50519429.3090809@huawei.com \
    --to=lizefan-hv44wf8li93qt0dzr+alfa@public$(echo .)gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public$(echo .)gmane.org \
    --cc=gaofeng-BthXqXjhjHXQFUHtdCDX3A@public$(echo .)gmane.org \
    --cc=jhs-jkUAjuhPggJWk0Htik3J/w@public$(echo .)gmane.org \
    --cc=john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public$(echo .)gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public$(echo .)gmane.org \
    --cc=wagi-kQCPcA+X3s7YtjvyW6yDsg@public$(echo .)gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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