linux-mips
[Top] [All Lists]

Re: [PATCH 2/3] Setup min_low_pfn/max_low_pfn correctly

To: Franck Bui-Huu <vagabon.xyz@gmail.com>
Subject: Re: [PATCH 2/3] Setup min_low_pfn/max_low_pfn correctly
From: Ralf Baechle <ralf@linux-mips.org>
Date: Mon, 11 Dec 2006 18:16:40 +0000
Cc: linux-mips@linux-mips.org, Franck Bui-Huu <fbuihuu@gmail.com>
In-reply-to: <11654201103291-git-send-email-fbuihuu@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1165420110699-git-send-email-fbuihuu@gmail.com> <11654201103291-git-send-email-fbuihuu@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4.2.2i
On Wed, Dec 06, 2006 at 04:48:29PM +0100, Franck Bui-Huu wrote:

> The old code was assuming that min_low_pfn was always 0. This
> means that we can't handle platforms with a big hole at start
> of memory since mem_map[] size would blew up.

It was - and IP22 was paying a high price for that.  It's currently 1MB
on 32-bit and 1.75MB on 64-bit kernels - but used to be much higher in
the past.

Btw, I think you're confusing the terms here; your patch description reads
wrong while the patch looks fine.  PFN is page frame number, not physical
frame number.  To avoid wasting dead mem_map[] entries idealy the pfn for
the first allocatable page should be zero.
So ignoring NUMA and discontig memory for a moment (those make everything
more complicated ...) PFN 0 is the first entry in mem_map[] - which usually
but not necessarily is physical address 0x0.

> This patch does not relax this constraint but it's a first
> step to achieve that.

> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index 89440a0..8e58d7f 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -271,7 +271,6 @@ static void __init bootmem_init(void)
>  static void __init bootmem_init(void)
>  {
>       unsigned long reserved_end;
> -     unsigned long highest = 0;
>       unsigned long mapstart = -1UL;

Assigning a negative number to an unsigned long variable ...

>       unsigned long bootmap_size;
>       int i;
> @@ -284,6 +283,13 @@ static void __init bootmem_init(void)
>       reserved_end = max(init_initrd(), PFN_UP(__pa_symbol(&_end)));
>  
>       /*
> +      * max_low_pfn is not a number of pages. The number of pages
> +      * of the system is given by 'max_low_pfn - min_low_pfn'.
> +      */
> +     min_low_pfn = -1UL;

Assigning a negative number to an unsigned long variable ...

  Ralf

<Prev in Thread] Current Thread [Next in Thread>