From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Daniel Wagner <wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
cgroups-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>
Subject: Re: [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
Date: Thu, 13 Sep 2012 15:14:16 +0800 [thread overview]
Message-ID: <505187C8.9030001@huawei.com> (raw)
In-Reply-To: <505183E3.3030409-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
On 2012/9/13 14:57, Daniel Wagner wrote:
> Hi Li,
>
> On 13.09.2012 08:41, Li Zefan wrote:
>>> @@ -1321,11 +1321,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
>>> * take duplicate reference counts on a subsystem that's already used,
>>> * but rebind_subsystems handles this case.
>>> */
>>> - for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
>>> + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
>>> unsigned long bit = 1UL << i;
>>>
>>> if (!(bit & opts->subsys_mask))
>>> continue;
>>> + if (!subsys[i]->module)
>>> + continue;
>>
>> This check is not necessary. If it's builtin, try_module_get() will just return 1, and
>> we're fine.
>
> Yes, I didn't see the try_module_get. Although I think with leaving the test away it would change the behavior, e.g.
>
> if (!subsys[i]->module)
> continue;
> if (!try_module_get(subsys[i]->module)) {
> module_pin_failed = true;
> break;
> }
>
> module_pin_failed would be set then and we would jump into the error code later.
>
no behavioral change. For a builtin subsys, we won't run into the if block and have module_pin_failed be set.
> This tests looks a bit ugly though I think leaving it away and relying on try_module_get() is not correct.
>
I don't think this is bad. The block layer code does the similar thing in elevator_get().
And we call module_put() unconditionally in rebind_subsys().
>>> @@ -1437,6 +1443,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
>>> INIT_LIST_HEAD(&cgrp->event_list);
>>> spin_lock_init(&cgrp->event_list_lock);
>>> simple_xattrs_init(&cgrp->xattrs);
>>> + memset(cgrp->subsys, 0, sizeof(cgrp->subsys));
>>
>> This seems an unrelated change, and is redundant. Am I missing something?
>
> The reason why it is necessary to NULL all the entries in the array, is that task_cls_classid() and task_netprioidx() check the return pointer from task_subsys_state(). If it is NULL those function know that the subsystem is not ready to be used. Should I move this change to the next patch then?
>
It's already guaranteed the passing @cgrp is zeored. that's why cgrp->flags is not explicitly initialized here.
WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Daniel Wagner <wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
Cc: <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
<cgroups-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>
Subject: Re: [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
Date: Thu, 13 Sep 2012 15:14:16 +0800 [thread overview]
Message-ID: <505187C8.9030001@huawei.com> (raw)
In-Reply-To: <505183E3.3030409-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
On 2012/9/13 14:57, Daniel Wagner wrote:
> Hi Li,
>
> On 13.09.2012 08:41, Li Zefan wrote:
>>> @@ -1321,11 +1321,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
>>> * take duplicate reference counts on a subsystem that's already used,
>>> * but rebind_subsystems handles this case.
>>> */
>>> - for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
>>> + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
>>> unsigned long bit = 1UL << i;
>>>
>>> if (!(bit & opts->subsys_mask))
>>> continue;
>>> + if (!subsys[i]->module)
>>> + continue;
>>
>> This check is not necessary. If it's builtin, try_module_get() will just return 1, and
>> we're fine.
>
> Yes, I didn't see the try_module_get. Although I think with leaving the test away it would change the behavior, e.g.
>
> if (!subsys[i]->module)
> continue;
> if (!try_module_get(subsys[i]->module)) {
> module_pin_failed = true;
> break;
> }
>
> module_pin_failed would be set then and we would jump into the error code later.
>
no behavioral change. For a builtin subsys, we won't run into the if block and have module_pin_failed be set.
> This tests looks a bit ugly though I think leaving it away and relying on try_module_get() is not correct.
>
I don't think this is bad. The block layer code does the similar thing in elevator_get().
And we call module_put() unconditionally in rebind_subsys().
>>> @@ -1437,6 +1443,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
>>> INIT_LIST_HEAD(&cgrp->event_list);
>>> spin_lock_init(&cgrp->event_list_lock);
>>> simple_xattrs_init(&cgrp->xattrs);
>>> + memset(cgrp->subsys, 0, sizeof(cgrp->subsys));
>>
>> This seems an unrelated change, and is redundant. Am I missing something?
>
> The reason why it is necessary to NULL all the entries in the array, is that task_cls_classid() and task_netprioidx() check the return pointer from task_subsys_state(). If it is NULL those function know that the subsystem is not ready to be used. Should I move this change to the next patch then?
>
It's already guaranteed the passing @cgrp is zeored. that's why cgrp->flags is not explicitly initialized here.
next prev parent reply other threads:[~2012-09-13 7:14 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
[not found] ` <1347459128-32236-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-12 14:12 ` [PATCH v4 1/8] cgroup: net_cls: Move sock_update_classid() declaration to cls_cgroup.h Daniel Wagner
[not found] ` <1347459128-32236-2-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13 6:34 ` Li Zefan
2012-09-13 6:34 ` Li Zefan
2012-09-12 14:12 ` [PATCH v4 5/8] cgroup: Wrap subsystem selection macro Daniel Wagner
[not found] ` <1347459128-32236-6-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13 6:41 ` Li Zefan
2012-09-13 6:41 ` Li Zefan
2012-09-12 18:56 ` [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Tejun Heo
2012-09-13 14:01 ` Neil Horman
2012-09-12 14:12 ` [PATCH v4 2/8] cgroup: net_cls: Do not define task_cls_classid() when not selected Daniel Wagner
2012-09-13 6:35 ` Li Zefan
2012-09-13 6:35 ` Li Zefan
2012-09-12 14:12 ` [PATCH v4 3/8] cgroup: net_prio: Do not define task_netpioidx() " Daniel Wagner
[not found] ` <1347459128-32236-4-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13 6:36 ` Li Zefan
2012-09-13 6:36 ` Li Zefan
2012-09-12 14:12 ` [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT Daniel Wagner
[not found] ` <1347459128-32236-5-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13 6:41 ` Li Zefan
2012-09-13 6:41 ` Li Zefan
[not found] ` <50517FFF.4030106-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-09-13 6:57 ` Daniel Wagner
[not found] ` <505183E3.3030409-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13 7:14 ` Li Zefan [this message]
2012-09-13 7:14 ` Li Zefan
[not found] ` <505187C8.9030001-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-09-13 7:38 ` Daniel Wagner
2012-09-12 14:12 ` [PATCH v4 6/8] cgroup: Do not depend on a given order when populating the subsys array Daniel Wagner
[not found] ` <1347459128-32236-7-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13 6:42 ` Li Zefan
2012-09-13 6:42 ` Li Zefan
2012-09-12 14:12 ` [PATCH v4 7/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
[not found] ` <1347459128-32236-8-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13 6:45 ` Li Zefan
2012-09-13 6:45 ` Li Zefan
2012-09-12 14:12 ` [PATCH v4 8/8] cgroup: Define CGROUP_SUBSYS_COUNT according the configuration Daniel Wagner
[not found] ` <1347459128-32236-9-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13 6:46 ` Li Zefan
2012-09-13 6:46 ` Li Zefan
2012-09-13 18:13 ` [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Tejun Heo
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=505187C8.9030001@huawei.com \
--to=lizefan-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org \
--cc=gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org \
--cc=jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org \
--cc=john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
--cc=wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.