* Subject: [PATCH] slab: remove bootmem calling
2009-05-28 13:29 [PATCH] init: call vfs_caches_init_early() later in the boot sequence Pekka Enberg
@ 2009-05-29 1:10 ` Yinghai Lu
2009-06-01 13:10 ` Nick Piggin
2009-05-29 1:12 ` Yinghai Lu
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Yinghai Lu @ 2009-05-29 1:10 UTC (permalink / raw)
To: Pekka Enberg; +Cc: mingo, cl, torvals, mpm, npiggin, linux-kernel
mem_init/kmem_cache_init is moved up
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
mm/page_cgroup.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
Index: linux-2.6/mm/page_cgroup.c
===================================================================
--- linux-2.6.orig/mm/page_cgroup.c
+++ linux-2.6/mm/page_cgroup.c
@@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroup
struct 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_cgroup
return 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);
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: Subject: [PATCH] slab: remove bootmem calling
2009-05-29 1:10 ` Subject: [PATCH] slab: remove bootmem calling Yinghai Lu
@ 2009-06-01 13:10 ` Nick Piggin
0 siblings, 0 replies; 12+ messages in thread
From: Nick Piggin @ 2009-06-01 13:10 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Pekka Enberg, mingo, cl, torvals, mpm, linux-kernel
On Thu, May 28, 2009 at 06:10:05PM -0700, Yinghai Lu wrote:
> 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?
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> mm/page_cgroup.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> Index: linux-2.6/mm/page_cgroup.c
> ===================================================================
> --- linux-2.6.orig/mm/page_cgroup.c
> +++ linux-2.6/mm/page_cgroup.c
> @@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroup
> struct 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_cgroup
> return 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);
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] slab: remove bootmem calling
2009-05-28 13:29 [PATCH] init: call vfs_caches_init_early() later in the boot sequence Pekka Enberg
2009-05-29 1:10 ` Subject: [PATCH] slab: remove bootmem calling Yinghai Lu
@ 2009-05-29 1:12 ` Yinghai Lu
2009-05-29 1:15 ` Yinghai Lu
2009-06-01 13:08 ` [PATCH] init: call vfs_caches_init_early() later in the boot sequence Nick Piggin
3 siblings, 0 replies; 12+ messages in thread
From: Yinghai Lu @ 2009-05-29 1:12 UTC (permalink / raw)
To: Pekka Enberg; +Cc: mingo, cl, torvals, mpm, npiggin, linux-kernel
mem_init/kmem_cache_init is moved up
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
mm/page_cgroup.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
Index: linux-2.6/mm/page_cgroup.c
===================================================================
--- linux-2.6.orig/mm/page_cgroup.c
+++ linux-2.6/mm/page_cgroup.c
@@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroup
struct 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_cgroup
return 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);
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH] slab: remove bootmem calling
2009-05-28 13:29 [PATCH] init: call vfs_caches_init_early() later in the boot sequence Pekka Enberg
2009-05-29 1:10 ` Subject: [PATCH] slab: remove bootmem calling Yinghai Lu
2009-05-29 1:12 ` Yinghai Lu
@ 2009-05-29 1:15 ` Yinghai Lu
2009-05-29 1:18 ` Yinghai Lu
2009-05-29 8:52 ` Pekka Enberg
2009-06-01 13:08 ` [PATCH] init: call vfs_caches_init_early() later in the boot sequence Nick Piggin
3 siblings, 2 replies; 12+ messages in thread
From: Yinghai Lu @ 2009-05-29 1:15 UTC (permalink / raw)
To: Pekka Enberg
Cc: mingo, Christoph Lameter, Linus Torvalds, mpm, npiggin,
linux-kernel
mem_init/kmem_cache_init is moved up
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
mm/page_cgroup.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
Index: linux-2.6/mm/page_cgroup.c
===================================================================
--- linux-2.6.orig/mm/page_cgroup.c
+++ linux-2.6/mm/page_cgroup.c
@@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroup
struct 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_cgroup
return 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);
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] slab: remove bootmem calling
2009-05-29 1:15 ` Yinghai Lu
@ 2009-05-29 1:18 ` Yinghai Lu
2009-05-29 9:07 ` Pekka Enberg
2009-05-29 8:52 ` Pekka Enberg
1 sibling, 1 reply; 12+ messages in thread
From: Yinghai Lu @ 2009-05-29 1:18 UTC (permalink / raw)
To: Pekka Enberg, mingo, Christoph Lameter, Linus Torvalds
Cc: mpm, npiggin, linux-kernel
Yinghai Lu wrote:
> mem_init/kmem_cache_init is moved up
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> mm/page_cgroup.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> Index: linux-2.6/mm/page_cgroup.c
> ===================================================================
> --- linux-2.6.orig/mm/page_cgroup.c
> +++ linux-2.6/mm/page_cgroup.c
> @@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroup
> struct 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_cgroup
> return 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);
any good way to replace __alloc_bootmem_node that could take alignment?
YH
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] slab: remove bootmem calling
2009-05-29 1:18 ` Yinghai Lu
@ 2009-05-29 9:07 ` Pekka Enberg
2009-05-29 14:03 ` Christoph Lameter
0 siblings, 1 reply; 12+ messages in thread
From: Pekka Enberg @ 2009-05-29 9:07 UTC (permalink / raw)
To: Yinghai Lu
Cc: mingo, Christoph Lameter, Linus Torvalds, mpm, npiggin,
linux-kernel
On Thu, 2009-05-28 at 18:18 -0700, Yinghai Lu wrote:
> Yinghai Lu wrote:
> > mem_init/kmem_cache_init is moved up
> >
> > Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> > ---
> > mm/page_cgroup.c | 12 ++++++++----
> > 1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > Index: linux-2.6/mm/page_cgroup.c
> > ===================================================================
> > --- linux-2.6.orig/mm/page_cgroup.c
> > +++ linux-2.6/mm/page_cgroup.c
> > @@ -47,6 +47,8 @@ static int __init alloc_node_page_cgroup
> > struct 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_cgroup
> > return 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);
>
> any good way to replace __alloc_bootmem_node that 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] slab: remove bootmem calling
2009-05-29 9:07 ` Pekka Enberg
@ 2009-05-29 14:03 ` Christoph Lameter
0 siblings, 0 replies; 12+ messages in thread
From: Christoph Lameter @ 2009-05-29 14:03 UTC (permalink / raw)
To: Pekka Enberg
Cc: Yinghai Lu, mingo, Linus Torvalds, mpm, npiggin, linux-kernel
On Fri, 29 May 2009, Pekka Enberg wrote:
> 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.
The page allocator returns PAGE_SIZE << order aligned chunks. This should
be ok.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] slab: remove bootmem calling
2009-05-29 1:15 ` Yinghai Lu
2009-05-29 1:18 ` Yinghai Lu
@ 2009-05-29 8:52 ` Pekka Enberg
1 sibling, 0 replies; 12+ messages in thread
From: Pekka Enberg @ 2009-05-29 8:52 UTC (permalink / raw)
To: Yinghai Lu
Cc: mingo, Christoph Lameter, Linus Torvalds, mpm, npiggin,
linux-kernel
Hi Yinghai,
On Thu, 2009-05-28 at 18:15 -0700, Yinghai Lu wrote:
> mem_init/kmem_cache_init is moved up
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] init: call vfs_caches_init_early() later in the boot sequence
2009-05-28 13:29 [PATCH] init: call vfs_caches_init_early() later in the boot sequence Pekka Enberg
` (2 preceding siblings ...)
2009-05-29 1:15 ` Yinghai Lu
@ 2009-06-01 13:08 ` Nick Piggin
2009-06-02 6:48 ` Pekka Enberg
3 siblings, 1 reply; 12+ messages in thread
From: Nick Piggin @ 2009-06-01 13:08 UTC (permalink / raw)
To: Pekka Enberg; +Cc: mingo, cl, torvals, mpm, yinghai, linux-kernel
On Thu, May 28, 2009 at 04:29:25PM +0300, Pekka Enberg wrote:
> From: Pekka Enberg <penberg@cs.helsinki.fi>
>
> 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().
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.
> Cc: Christoph Lameter <cl@linux-foundation.com>
> Cc: Linus Torvalds <torvals@linux-foundation.org>
> Cc: Matt Mackall <mpm@selenic.com>
> Cc: Nick Piggin <npiggin@suse.de>
> Cc: Yinghai Lu <yinghai@kernel.org>
> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
> fs/dcache.c | 2 +-
> fs/inode.c | 2 +-
> init/main.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/dcache.c b/fs/dcache.c
> index ee60ce4..6c48ba1 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -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);
> diff --git a/fs/inode.c b/fs/inode.c
> index 0571983..92379c8 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -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);
> diff --git a/init/main.c b/init/main.c
> index 5a19578..f6bd51f 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -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();
> --
> 1.6.0.4
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] init: call vfs_caches_init_early() later in the boot sequence
2009-06-01 13:08 ` [PATCH] init: call vfs_caches_init_early() later in the boot sequence Nick Piggin
@ 2009-06-02 6:48 ` Pekka Enberg
2009-06-02 6:55 ` Nick Piggin
0 siblings, 1 reply; 12+ messages in thread
From: Pekka Enberg @ 2009-06-02 6:48 UTC (permalink / raw)
To: Nick Piggin; +Cc: mingo, cl, torvalds, mpm, yinghai, linux-kernel
Hi Nick,
[ I see I typo'd Linus' email address in the original patch submission... ]
On Thu, May 28, 2009 at 04:29:25PM +0300, Pekka Enberg wrote:
>> From: Pekka Enberg <penberg@cs.helsinki.fi>
>>
>> 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().
On Mon, Jun 1, 2009 at 4:08 PM, Nick Piggin <npiggin@suse.de> wrote:
> 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.
OK, makes sense. IIRC, Linus suggested doing this but I think I'll
just revert the patch.
Pekka
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] init: call vfs_caches_init_early() later in the boot sequence
2009-06-02 6:48 ` Pekka Enberg
@ 2009-06-02 6:55 ` Nick Piggin
0 siblings, 0 replies; 12+ messages in thread
From: Nick Piggin @ 2009-06-02 6:55 UTC (permalink / raw)
To: Pekka Enberg; +Cc: mingo, cl, torvalds, mpm, yinghai, linux-kernel
On Tue, Jun 02, 2009 at 09:48:32AM +0300, Pekka Enberg wrote:
> Hi Nick,
>
> [ I see I typo'd Linus' email address in the original patch submission... ]
>
> On Thu, May 28, 2009 at 04:29:25PM +0300, Pekka Enberg wrote:
> >> From: Pekka Enberg <penberg@cs.helsinki.fi>
> >>
> >> 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().
>
> On Mon, Jun 1, 2009 at 4:08 PM, Nick Piggin <npiggin@suse.de> wrote:
> > 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.
>
> 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...
^ permalink raw reply [flat|nested] 12+ messages in thread