[PATCH] powerpc: rheap-managed bootmem allocator

Kumar Gala galak at kernel.crashing.org
Thu Sep 20 06:12:19 EST 2007


On Sep 19, 2007, at 2:15 PM, Timur Tabi wrote:

> Add the ability to allocate a block of memory via alloc_bootmem()  
> and manage
> that memory with a remote heap (rheap).
>
> Signed-off-by: Timur Tabi <timur at freescale.com>
> ---
>
> This patch will conflict with Sylvain's "powerpc: Changes the  
> config mechanism
> for rheap" patch, but that patch hasn't been accepted yet, so I'm  
> posting this
> for review and comment.
>
>  arch/powerpc/lib/rheap.c    |   79 ++++++++++++++++++++++++++++++++ 
> +++++++++++
>  include/asm-powerpc/rheap.h |    4 ++
>  2 files changed, 83 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
> index ada5b42..d2c8913 100644
> --- a/arch/powerpc/lib/rheap.c
> +++ b/arch/powerpc/lib/rheap.c
> @@ -18,6 +18,8 @@
>  #include <linux/mm.h>
>  #include <linux/err.h>
>  #include <linux/slab.h>
> +#include <linux/bootmem.h>
> +#include <linux/module.h>
>
>  #include <asm/rheap.h>
>
> @@ -729,3 +731,80 @@ void rh_dump_blk(rh_info_t * info, rh_block_t  
> * blk)
>  	       "blk @0x%p: 0x%lx-0x%lx (%u)\n",
>  	       blk, blk->start, blk->start + blk->size, blk->size);
>  }
> +
> +/* Bootmem-allocated rheap
> + *
> + * If the "rhbootmem=X" command-line parameter is specified, then  
> the RHEAP
> + * code will allocate a chunk of memory using alloc_bootmem() and  
> create an
> + * rheap for it.
> +*/
> +
> +static rh_info_t bootmem_rh_info;
> +static rh_block_t bootmem_rh_block[16];
> +
> +static void *bootmem_ptr;
> +static unsigned long bootmem_size;
> +
> +static int __init early_parse_rhbootmem(char *p)
> +{
> +	if (!p)
> +		return 1;
> +
> +	bootmem_size = _ALIGN_UP(memparse(p, &p), 32);
> +
> +	return 0;

seems like we should have a way to set bootmem_size via board/ 
platform code and not require a cmdline arg.

> +}
> +early_param("rhbootmem", early_parse_rhbootmem);
> +



More information about the Linuxppc-dev mailing list