lkml.org 
[lkml]   [2009]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] sparsemem: put mem map for one node together.

* Yinghai Lu <yinghai@kernel.org> wrote:

> add vmemmap_alloc_block_buf for mem map only.
>
> it will fallback old wayif can not get that big.
>
> it will help system with more memory that use early_res instead of bootmem
> that can not handle too many entries
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> arch/x86/mm/init_64.c | 2
> include/linux/mm.h | 7 +++
> mm/sparse-vmemmap.c | 70 +++++++++++++++++++++++++++++++
> mm/sparse.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 4 files changed, 187 insertions(+), 3 deletions(-)


> +++ linux-2.6/mm/sparse-vmemmap.c
> @@ -43,6 +43,8 @@ static void * __init_refok __earlyonly_b
> return __alloc_bootmem_node_high(NODE_DATA(node), size, align, goal);
> }
>
> +static void *buf;
> +static void *buf_end;

there's so many buf's in the kernel - this naming isnt very intuitive. Also,
they should perhaps be __initdata-ish?

> void * __meminit vmemmap_alloc_block(unsigned long size, int node)
> {
> @@ -64,6 +66,24 @@ void * __meminit vmemmap_alloc_block(uns
> __pa(MAX_DMA_ADDRESS));
> }
>
> +/* need to make sure size is all the same during early stage */
> +void * __meminit vmemmap_alloc_block_buf(unsigned long size, int node)
> +{
> + void *ptr;
> +
> + if (!buf)
> + return vmemmap_alloc_block(size, node);
> +
> + /* take the from buf */
> + ptr = (void *)ALIGN((unsigned long)buf, size);

Hm, two type cast in the same line.

these kinds of x86-64-isms:

> +++ linux-2.6/mm/sparse.c
>
> +#ifndef CONFIG_X86_64
> +#ifdef CONFIG_X86_64
> +#ifdef CONFIG_X86_64
> +#else
> +#endif
> +#ifdef CONFIG_X86_64
> +#endif

are not particularly welcome constructs in core MM files. Appropriately
structured Kconfig helper bools, selected by arch's, are cleaner.

These patches need more work.

Ingo


\
 
 \ /
  Last update: 2009-12-28 09:39    [W:0.439 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site