Re: [PATCH 2/2] sparsemem: put mem map for one node together.
From: Ingo Molnar
Date: Mon Dec 28 2009 - 03:36:17 EST
* Yinghai Lu <yinghai@xxxxxxxxxx> 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@xxxxxxxxxx>
>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/