init: call vfs_caches_init_early() later in the boot sequence
Subsystems (2)
PATCH 1/1 init: call vfs_caches_init_early() later in the boot sequence
From: Pekka Enberg <[email protected]>
There's no need to call vfs_caches_init_early() before kmem_cache_init(). All we have to do is make sure we don't attempt to use the bootmem allocator after we've called mem_init().
--- fs/dcache.c | 2 +- fs/inode.c | 2 +- init/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
fs/dcache.c +1 -1
@@ -2255,7 +2255,7 @@ static void __init dcache_init_early(void)sizeof (struct hlist_head ), dhash_entries,13 , -HASH_EARLY , +0 , &d_hash_shift, &d_hash_mask, 0);
fs/inode.c +1 -1
@@ -1487,7 +1487,7 @@ void __init inode_init_early(void)sizeof (struct hlist_head ), ihash_entries,14 , -HASH_EARLY , +0 , &i_hash_shift, &i_hash_mask, 0);
init/main.c +1 -1
@@ -588,7 +588,6 @@ asmlinkage void __init start_kernel(void)* kmem_cache_init() */ pidhash_init (); -vfs_caches_init_early ();/* * Set up kernel memory allocators */
@@ -658,6 +657,7 @@ asmlinkage void __init start_kernel(void) initrd_start = 0; }#endif +vfs_caches_init_early ();cpuset_init_early ();page_cgroup_init ();enable_debug_pagealloc ();
Signature · 1 line
1.6.0.4
Subject: [PATCH] slab: remove bootmem calling
mem_init/kmem_cache_init is moved up
--- mm/page_cgroup.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
mm/page_cgroup.c +8 -4
@@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroupstruct page_cgroup *base, *pc;unsigned long table_size;unsigned long start_pfn, nr_pages, index; +struct page *page; +unsigned int order; start_pfn =NODE_DATA (nid)->node_start_pfn; nr_pages =NODE_DATA (nid)->node_spanned_pages;
@@ -55,11 +57,13 @@ static int __init alloc_node_page_cgroupreturn 0 ; table_size =sizeof (struct page_cgroup ) * nr_pages; - - base =__alloc_bootmem_node_nopanic (NODE_DATA (nid), - table_size,PAGE_SIZE ,__pa (MAX_DMA_ADDRESS )); -if (!base) + order =get_order (table_size); + page =alloc_pages_node (nid,GFP_NOWAIT | __GFP_ZERO, order); +if (!page) + page =alloc_pages_node (-1 ,GFP_NOWAIT | __GFP_ZERO, order); +if (!page)return -ENOMEM ; + base =page_address (page);for (index =0 ; index < nr_pages; index++) { pc = base + index;__init_page_cgroup (pc, start_pfn + index);
Re: Subject: [PATCH] slab: remove bootmem calling
Quoted 1 line · Yinghai Lu
mem_init/kmem_cache_init is moved up
Is there a way we could start documenting/improving these dependencies of bootup stuff? A comment with depends/provides lines?
Quoted 37 lines
Signed-off-by Yinghai Lu <[email protected]>--- mm/page_cgroup.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)Index:
linux-2.6/mm/page_cgroup.c
===================================================================mm/page_cgroup.c +8
-4@@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroupstruct page_cgroup *base, *pc;unsigned long table_size;unsigned long start_pfn, nr_pages, index; +struct page *page; +unsigned int order; start_pfn =NODE_DATA (nid)->node_start_pfn; nr_pages =NODE_DATA (nid)->node_spanned_pages;@@ -55,11 +57,13 @@ static int __init alloc_node_page_cgroupreturn 0 ; table_size =sizeof (struct page_cgroup ) * nr_pages; - - base =__alloc_bootmem_node_nopanic (NODE_DATA (nid), - table_size,PAGE_SIZE ,__pa (MAX_DMA_ADDRESS )); -if (!base) + order =get_order (table_size); + page =alloc_pages_node (nid,GFP_NOWAIT | __GFP_ZERO, order); +if (!page) + page =alloc_pages_node (-1 ,GFP_NOWAIT | __GFP_ZERO, order); +if (!page)return -ENOMEM ; + base =page_address (page);for (index =0 ; index < nr_pages; index++) { pc = base + index;__init_page_cgroup (pc, start_pfn + index);
PATCH 1/1 slab: remove bootmem calling
In reply to Pekka Enbergmem_init/kmem_cache_init is moved up
--- mm/page_cgroup.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
mm/page_cgroup.c +8 -4
@@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroupstruct page_cgroup *base, *pc;unsigned long table_size;unsigned long start_pfn, nr_pages, index; +struct page *page; +unsigned int order; start_pfn =NODE_DATA (nid)->node_start_pfn; nr_pages =NODE_DATA (nid)->node_spanned_pages;
@@ -55,11 +57,13 @@ static int __init alloc_node_page_cgroupreturn 0 ; table_size =sizeof (struct page_cgroup ) * nr_pages; - - base =__alloc_bootmem_node_nopanic (NODE_DATA (nid), - table_size,PAGE_SIZE ,__pa (MAX_DMA_ADDRESS )); -if (!base) + order =get_order (table_size); + page =alloc_pages_node (nid,GFP_NOWAIT | __GFP_ZERO, order); +if (!page) + page =alloc_pages_node (-1 ,GFP_NOWAIT | __GFP_ZERO, order); +if (!page)return -ENOMEM ; + base =page_address (page);for (index =0 ; index < nr_pages; index++) { pc = base + index;__init_page_cgroup (pc, start_pfn + index);
PATCH 1/1 slab: remove bootmem calling
In reply to Pekka Enbergmem_init/kmem_cache_init is moved up
--- mm/page_cgroup.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
mm/page_cgroup.c +8 -4
@@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroupstruct page_cgroup *base, *pc;unsigned long table_size;unsigned long start_pfn, nr_pages, index; +struct page *page; +unsigned int order; start_pfn =NODE_DATA (nid)->node_start_pfn; nr_pages =NODE_DATA (nid)->node_spanned_pages;
@@ -55,11 +57,13 @@ static int __init alloc_node_page_cgroupreturn 0 ; table_size =sizeof (struct page_cgroup ) * nr_pages; - - base =__alloc_bootmem_node_nopanic (NODE_DATA (nid), - table_size,PAGE_SIZE ,__pa (MAX_DMA_ADDRESS )); -if (!base) + order =get_order (table_size); + page =alloc_pages_node (nid,GFP_NOWAIT | __GFP_ZERO, order); +if (!page) + page =alloc_pages_node (-1 ,GFP_NOWAIT | __GFP_ZERO, order); +if (!page)return -ENOMEM ; + base =page_address (page);for (index =0 ; index < nr_pages; index++) { pc = base + index;__init_page_cgroup (pc, start_pfn + index);
Re: [PATCH] slab: remove bootmem calling
Quoted 25 lines · Yinghai Lu
mem_init/kmem_cache_init is moved up
Signed-off-by Yinghai Lu <[email protected]>--- mm/page_cgroup.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)Index:
linux-2.6/mm/page_cgroup.c
===================================================================mm/page_cgroup.c +2
-1@@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroupstruct page_cgroup *base, *pc;unsigned long table_size;unsigned long start_pfn, nr_pages, index; +struct page *page; +unsigned int order; start_pfn =NODE_DATA (nid)->node_start_pfn; nr_pages =NODE_DATA (nid)->node_spanned_pages;@@ -55,11 +57,13 @@ static int __init alloc_node_page_cgroupreturn 0 ; table_size =sizeof (struct page_cgroup ) * nr_pages; -
mm/page_cgroup.c static int __init alloc_node_page_cgroup · line 66
Quoted 10 lines
mm/page_cgroup.c +6
-3- base =__alloc_bootmem_node_nopanic (NODE_DATA (nid), - table_size,PAGE_SIZE ,__pa (MAX_DMA_ADDRESS )); -if (!base) + order =get_order (table_size); + page =alloc_pages_node (nid,GFP_NOWAIT | __GFP_ZERO, order); +if (!page) + page =alloc_pages_node (-1 ,GFP_NOWAIT | __GFP_ZERO, order); +if (!page)return -ENOMEM ; + base =page_address (page);
any good way to replace __alloc_bootmem_node that could take alignment?
YH
Re: [PATCH] slab: remove bootmem calling
Quoted 24 lines · Yinghai Lu
Quoted 23 lines · Yinghai Lu
mem_init/kmem_cache_init is moved up
Signed-off-by Yinghai Lu <[email protected]>--- mm/page_cgroup.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)Index:
linux-2.6/mm/page_cgroup.c
===================================================================mm/page_cgroup.c +2
-0@@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroupstruct page_cgroup *base, *pc;unsigned long table_size;unsigned long start_pfn, nr_pages, index; +struct page *page; +unsigned int order; start_pfn =NODE_DATA (nid)->node_start_pfn; nr_pages =NODE_DATA (nid)->node_spanned_pages;@@ -55,11 +57,13 @@ static int __init alloc_node_page_cgroupreturn 0 ;
Quoted 14 lines
mm/page_cgroup.c static int __init alloc_node_page_cgroup · line 66
Quoted 12 lines
mm/page_cgroup.c +6
-4table_size =sizeof (struct page_cgroup ) * nr_pages; - - base =__alloc_bootmem_node_nopanic (NODE_DATA (nid), - table_size,PAGE_SIZE ,__pa (MAX_DMA_ADDRESS )); -if (!base) + order =get_order (table_size); + page =alloc_pages_node (nid,GFP_NOWAIT | __GFP_ZERO, order); +if (!page) + page =alloc_pages_node (-1 ,GFP_NOWAIT | __GFP_ZERO, order); +if (!page)return -ENOMEM ; + base =page_address (page);any good way to replace
__alloc_bootmem_nodethat could take alignment?
Not that I am aware of. Where do you need that? This one looks ok to me as page allocator obviously returns PAGE_SIZE aligned chunks.
Pekka
Re: [PATCH] slab: remove bootmem calling
Quoted 2 lines · Pekka Enberg
Not that I am aware of. Where do you need that? This one looks ok to me as page allocator obviously returns
PAGE_SIZEaligned chunks.
The page allocator returns PAGE_SIZE << order aligned chunks. This should be ok.
Re: [PATCH] slab: remove bootmem calling
In reply to Yinghai LuHi Yinghai,
Quoted 3 lines · Yinghai Lu
mem_init/kmem_cache_init is moved up
Signed-off-by Yinghai Lu <[email protected]>
Thanks!
I cleaned up the changelogs a bit and applied in 'topic/slab/earlyboot' branch in my tree:
http://git.kernel.org/?p=linux/kernel/git/penberg/slab-2.6.git;a=shortlog;h=topic/slab/earlyboot
I expect Ingo to pick up these changes at some point and we can move the development of this patch series to -tip. But for now, please send patches against my tree.
Pekka
Quoted 5 lines · Pekka Enberg
From: Pekka Enberg <[email protected]>
There's no need to call
vfs_caches_init_early()beforekmem_cache_init(). All we have to do is make sure we don't attempt to use the bootmem allocator after we've calledmem_init().
Hmm, but you'd want to be able to allocate > MAX_ORDER areas in the linear KVA, which the page allocator cannot do. So this is just going to silently truncate hash table size. Nack on this one.
Quoted 62 lines
Cc Christoph Lameter <[email protected]>Cc Linus Torvalds <[email protected]>Cc Matt Mackall <[email protected]>Cc Nick Piggin <[email protected]>Cc Yinghai Lu <[email protected]>Signed-off-by Pekka Enberg <[email protected]>--- fs/dcache.c | 2 +- fs/inode.c | 2 +- init/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)fs/dcache.c +1
-1@@ -2255,7 +2255,7 @@ static void __init dcache_init_early(void)sizeof (struct hlist_head ), dhash_entries,13 , -HASH_EARLY , +0 , &d_hash_shift, &d_hash_mask, 0);fs/inode.c +1
-1@@ -1487,7 +1487,7 @@ void __init inode_init_early(void)sizeof (struct hlist_head ), ihash_entries,14 , -HASH_EARLY , +0 , &i_hash_shift, &i_hash_mask, 0);init/main.c +1
-1@@ -588,7 +588,6 @@ asmlinkage void __init start_kernel(void)* kmem_cache_init() */ pidhash_init (); -vfs_caches_init_early ();/* * Set up kernel memory allocators */ @@ -658,6 +657,7 @@ asmlinkage void __init start_kernel(void) initrd_start = 0; }#endif +vfs_caches_init_early ();cpuset_init_early ();page_cgroup_init ();enable_debug_pagealloc ();Signature · 1 line
1.6.0.4
Hi Nick,
[ I see I typo'd Linus' email address in the original patch submission... ]
Quoted 5 lines · Pekka Enberg
Quoted 5 lines
From: Pekka Enberg <[email protected]>
There's no need to call
vfs_caches_init_early()beforekmem_cache_init(). All we have to do is make sure we don't attempt to use the bootmem allocator after we've calledmem_init().
Quoted 3 lines · Nick Piggin
Hmm, but you'd want to be able to allocate >
MAX_ORDERareas in the linear KVA, which the page allocator cannot do. So this is just going to silently truncate hash table size. Nack on this one.
OK, makes sense. IIRC, Linus suggested doing this but I think I'll just revert the patch.
Pekka
Quoted 11 lines · Pekka Enberg
Hi Nick,
[ I see I typo'd Linus' email address in the original patch submission... ]
Quoted 5 lines · Pekka Enberg
Quoted 5 lines
From: Pekka Enberg <[email protected]>
There's no need to call
vfs_caches_init_early()beforekmem_cache_init(). All we have to do is make sure we don't attempt to use the bootmem allocator after we've calledmem_init().
Quoted 7 lines
Quoted 3 lines · Nick Piggin
Hmm, but you'd want to be able to allocate >
MAX_ORDERareas in the linear KVA, which the page allocator cannot do. So this is just going to silently truncate hash table size. Nack on this one.OK, makes sense. IIRC, Linus suggested doing this but I think I'll just revert the patch.
What might be interesting to do is to be able to switch the bootmem allocator to be able to run after the page allocator comes up (it would have to have a few hooks to put pages on and off the buddy lists, but should be possible). Then you could do these kinds of large allocations later (or set up allocators earlier).
But that might not be worth the complexity and churn just for these couple of cases...