2014-04-22 05:27:40

by Jianyu Zhan

[permalink] [raw]
Subject: [PATCH] cgroup: explicitly init the early_init field

For a cgroup subsystem who should init early, then it should carefully
take care of the implementation of css_alloc, because it will be called
before mm_init() setup the world.

Luckily we don't, and we better explicitly assign the early_init field
to 0, for document reason.

Signed-off-by: Jianyu Zhan <[email protected]>
---
kernel/cgroup.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 559f822..f23cb67 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -5325,5 +5325,6 @@ struct cgroup_subsys debug_cgrp_subsys = {
.css_alloc = debug_css_alloc,
.css_free = debug_css_free,
.base_cftypes = debug_files,
+ .early_init = 0,
};
#endif /* CONFIG_CGROUP_DEBUG */
--
2.0.0-rc0


2014-04-22 06:22:49

by Zefan Li

[permalink] [raw]
Subject: Re: [PATCH] cgroup: explicitly init the early_init field

On 2014/4/22 13:27, Jianyu Zhan wrote:
> For a cgroup subsystem who should init early, then it should carefully
> take care of the implementation of css_alloc, because it will be called
> before mm_init() setup the world.
>
> Luckily we don't, and we better explicitly assign the early_init field
> to 0, for document reason.
>

If you think this is the right thing to do, you can apply the same reason
to the initialization of other structures in the whole kernel tree.

> Signed-off-by: Jianyu Zhan <[email protected]>

nack

> ---
> kernel/cgroup.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 559f822..f23cb67 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -5325,5 +5325,6 @@ struct cgroup_subsys debug_cgrp_subsys = {
> .css_alloc = debug_css_alloc,
> .css_free = debug_css_free,
> .base_cftypes = debug_files,
> + .early_init = 0,
> };
> #endif /* CONFIG_CGROUP_DEBUG */
>

2014-04-22 06:45:11

by Jianyu Zhan

[permalink] [raw]
Subject: Re: [PATCH] cgroup: explicitly init the early_init field

On Tue, Apr 22, 2014 at 2:22 PM, Li Zefan <[email protected]> wrote:
> If you think this is the right thing to do, you can apply the same reason
> to the initialization of other structures in the whole kernel tree.
>
>> Signed-off-by: Jianyu Zhan <[email protected]>
>
> nack

Hi, Li,

Sorry for the noise.

For cpuset subsystem, this filed is nonzero; for other subsystems, this is zero.
Actually none of these subsystem will change this field, I just
thought that this is a little subtle. as the comment in patches says,
this is mainly for
document reason to inform other maintainers that css_alloc
implementation should be
taken care of , depending on this field is zero or not.


Thanks,
Jianyu Zhan