[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130304180430.GE30413@htj.dyndns.org>
Date: Mon, 4 Mar 2013 10:04:30 -0800
From: Tejun Heo <tj@...nel.org>
To: Li Zefan <lizefan@...wei.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
cgroups <cgroups@...r.kernel.org>
Subject: Re: [PATCH 2/2] cgroup: avoid accessing modular cgroup subsys
structure without locking
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists