From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
cgroups <cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 2/2] cgroup: avoid accessing modular cgroup subsys structure without locking
Date: Mon, 4 Mar 2013 10:04:30 -0800 [thread overview]
Message-ID: <20130304180430.GE30413@htj.dyndns.org> (raw)
In-Reply-To: <5130537C.5010608-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Hello, Li.
On Fri, Mar 01, 2013 at 03:06:36PM +0800, Li Zefan wrote:
> /* Define the enumeration of all builtin cgroup subsystems */
> #define SUBSYS(_x) _x ## _subsys_id,
> -#define IS_SUBSYS_ENABLED(option) IS_ENABLED(option)
> enum cgroup_subsys_id {
> +#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
> #include <linux/cgroup_subsys.h>
> +#undef IS_SUBSYS_ENABLED
> + CGROUP_BUILTIN_SUBSYS_COUNT,
> +
> + __CGROUP_SUBSYS_TEMP_PLACEHOLDER = CGROUP_BUILTIN_SUBSYS_COUNT - 1,
> +
> +#define IS_SUBSYS_ENABLED(option) IS_MODULE(option)
> +#include <linux/cgroup_subsys.h>
> +#undef IS_SUBSYS_ENABLED
> CGROUP_SUBSYS_COUNT,
> };
> -#undef IS_SUBSYS_ENABLED
> #undef SUBSYS
Arghh.... can we at least have a comment explaining what we're doing
here? It's ugly and confusing.
> @@ -5019,13 +5019,17 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
> tsk->cgroups = &init_css_set;
>
> if (run_callbacks && need_forkexit_callback) {
> - for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
> + /*
> + * 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 (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
Probably enough to say "for/exit callback are supported only for
builtin subsys, see cgroup_for() for details"?
Thanks.
--
tejun
next prev parent reply other threads:[~2013-03-04 18:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-01 7:06 [PATCH 1/2] cgroup: no need to check css refs for release notification Li Zefan
[not found] ` <5130535F.7060201-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-03-01 7:06 ` [PATCH 2/2] cgroup: avoid accessing modular cgroup subsys structure without locking Li Zefan
[not found] ` <5130537C.5010608-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-03-04 18:04 ` Tejun Heo [this message]
2013-03-04 18:05 ` [PATCH 1/2] cgroup: no need to check css refs for release notification 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=20130304180430.GE30413@htj.dyndns.org \
--to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@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