diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2008-10-22 17:15:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 11:55:02 -0400 |
commit | 94b6da5ab8293b04a300ba35c72eddfa94db8b02 (patch) | |
tree | 8ca1c8abb7934ab51657fffeb26a5f5aabd34743 /init/main.c | |
parent | be07c4ed4043ab8c26f222348136141335e47a2f (diff) |
memcg: fix page_cgroup allocation
page_cgroup_init() is called from mem_cgroup_init(). But at this
point, we cannot call alloc_bootmem().
(and this caused panic at boot.)
This patch moves page_cgroup_init() to init/main.c.
Time table is following:
==
parse_args(). # we can trust mem_cgroup_subsys.disabled bit after this.
....
cgroup_init_early() # "early" init of cgroup.
....
setup_arch() # memmap is allocated.
...
page_cgroup_init();
mem_init(); # we cannot call alloc_bootmem after this.
....
cgroup_init() # mem_cgroup is initialized.
==
Before page_cgroup_init(), mem_map must be initialized. So,
I added page_cgroup_init() to init/main.c directly.
(*) maybe this is not very clean but
- cgroup_init_early() is too early
- in cgroup_init(), we have to use vmalloc instead of alloc_bootmem().
use of vmalloc area in x86-32 is important and we should avoid very large
vmalloc() in x86-32. So, we want to use alloc_bootmem() and added page_cgroup_init()
directly to init/main.c
[akpm@linux-foundation.org: remove unneeded/bad mem_cgroup_subsys declaration]
[akpm@linux-foundation.org: fix build]
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Tested-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/init/main.c b/init/main.c index 3e17a3bafe60..672ae75b2059 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/key.h> | 52 | #include <linux/key.h> |
53 | #include <linux/unwind.h> | 53 | #include <linux/unwind.h> |
54 | #include <linux/buffer_head.h> | 54 | #include <linux/buffer_head.h> |
55 | #include <linux/page_cgroup.h> | ||
55 | #include <linux/debug_locks.h> | 56 | #include <linux/debug_locks.h> |
56 | #include <linux/debugobjects.h> | 57 | #include <linux/debugobjects.h> |
57 | #include <linux/lockdep.h> | 58 | #include <linux/lockdep.h> |
@@ -647,6 +648,7 @@ asmlinkage void __init start_kernel(void) | |||
647 | vmalloc_init(); | 648 | vmalloc_init(); |
648 | vfs_caches_init_early(); | 649 | vfs_caches_init_early(); |
649 | cpuset_init_early(); | 650 | cpuset_init_early(); |
651 | page_cgroup_init(); | ||
650 | mem_init(); | 652 | mem_init(); |
651 | enable_debug_pagealloc(); | 653 | enable_debug_pagealloc(); |
652 | cpu_hotplug_init(); | 654 | cpu_hotplug_init(); |