From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/6] cgroup: drop module support
Date: Wed, 29 Jan 2014 12:16:38 +0800 [thread overview]
Message-ID: <52E880A6.4040902@huawei.com> (raw)
In-Reply-To: <1390952641-15950-3-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> /**
> - * for_each_subsys - iterate all loaded cgroup subsystems
> + * for_each_subsys - iterate all enabled cgroup subsystems
> * @ss: the iteration cursor
> * @ssid: the index of @ss, CGROUP_SUBSYS_COUNT after reaching the end
> - *
> - * Iterates through all loaded subsystems. Should be called under
> - * cgroup_mutex or cgroup_root_mutex.
> */
> #define for_each_subsys(ss, ssid) \
> - for (({ cgroup_assert_mutex_or_root_locked(); (ssid) = 0; }); \
> - (ssid) < CGROUP_SUBSYS_COUNT; (ssid)++) \
> - if (!((ss) = cgroup_subsys[(ssid)])) { } \
> - else
> -
> -/**
> - * for_each_builtin_subsys - iterate all built-in cgroup subsystems
> - * @ss: the iteration cursor
> - * @i: the index of @ss, CGROUP_BUILTIN_SUBSYS_COUNT after reaching the end
> - *
> - * Bulit-in subsystems are always present and iteration itself doesn't
> - * require any synchronization.
> - */
> -#define for_each_builtin_subsys(ss, i) \
> - for ((i) = 0; (i) < CGROUP_BUILTIN_SUBSYS_COUNT && \
> - (((ss) = cgroup_subsys[i]) || true); (i)++)
> + for ((ssid) = 0; (ssid) < CGROUP_SUBSYS_COUNT && \
> + (((ss) = cgroup_subsys[ssid]) || true); (ssid)++)
Now cgroup_subsys[i] won't be NULL, so we can drop "|| true".
>
> /* iterate across the active hierarchies */
> #define for_each_active_root(root) \
> @@ -975,50 +951,24 @@ static void cgroup_d_remove_dir(struct dentry *dentry)
> remove_dir(dentry);
> }
>
...
> - if (need_forkexit_callback) {
> - /*
> - * fork/exit callbacks are supported only for builtin
> - * subsystems, and the builtin section of the subsys
> - * array is immutable, so we don't need to lock the
> - * subsys array here. On the other hand, modular section
> - * of the array can be freed at module unload, so we
> - * can't touch that.
> - */
> - for_each_builtin_subsys(ss, i)
> + if (need_forkexit_callback)
> + for_each_subsys(ss, i)
> if (ss->fork)
> ss->fork(child);
> - }
This looks a bit ugly. How about leaving the parentheses for the
outmost if statement?
if (need_forkexit_callback) {
for_each_subsys(ss, i)
if (ss->fork)
ss->fork(child);
}
next prev parent reply other threads:[~2014-01-29 4:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-28 23:43 [PATCHSET v2 cgroup/for-3.15] cgroup: drop module support and cgroup_root_mutex Tejun Heo
[not found] ` <1390952641-15950-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-01-28 23:43 ` [PATCH 1/6] cgroup: make CONFIG_CGROUP_NET_PRIO bool and drop unnecessary init_netclassid_cgroup() Tejun Heo
2014-01-28 23:43 ` [PATCH 3/6] cgroup: clean up cgroup_subsys names and initialization Tejun Heo
[not found] ` <1390952641-15950-4-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-01-29 0:04 ` Rafael J. Wysocki
2014-01-29 8:59 ` Michal Hocko
2014-01-29 10:46 ` Peter Zijlstra
[not found] ` <20140129104648.GC9636-ndre7Fmf5hadTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2014-01-30 9:16 ` Ingo Molnar
2014-01-29 16:23 ` Aristeu Rozanski
2014-01-28 23:43 ` [PATCH 4/6] cgroup: rename cgroup_subsys->subsys_id to ->id Tejun Heo
2014-01-28 23:44 ` [PATCH 5/6] cgroup: update locking in cgroup_show_options() Tejun Heo
2014-01-29 6:32 ` [PATCHSET v2 cgroup/for-3.15] cgroup: drop module support and cgroup_root_mutex Li Zefan
2014-02-08 15:36 ` Tejun Heo
2014-01-28 23:43 ` [PATCH 2/6] cgroup: drop module support Tejun Heo
[not found] ` <1390952641-15950-3-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-01-29 4:16 ` Li Zefan [this message]
[not found] ` <52E880A6.4040902-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-01-29 15:30 ` Tejun Heo
2014-01-29 16:05 ` [PATCH v3 " Tejun Heo
2014-01-28 23:44 ` [PATCH 6/6] cgroup: remove cgroup_root_mutex Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2014-01-17 18:11 [PATCHSET cgroup/for-3.14] cgroup: drop module support and cgroup_root_mutex Tejun Heo
[not found] ` <1389982317-22225-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-01-17 18:11 ` [PATCH 2/6] cgroup: drop module support 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=52E880A6.4040902@huawei.com \
--to=lizefan-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).