[Top] [All Lists]

Re: Question concerning memory configuration variables

To: Jeff Harrell <>
Subject: Re: Question concerning memory configuration variables
From: Ralf Baechle <>
Date: Wed, 2 Feb 2000 02:17:01 +0100
In-reply-to: <>
References: <>
On Tue, Feb 01, 2000 at 09:45:25AM -0700, Jeff Harrell wrote:

> I have been looking at 2.2.23 and noticed that a few things concerning
> memory paging has changed.  I wonder if anybody could give me a definition
> of a couple of the variables that are defined.  The first is the
> max_low_pfn variable.  It looks like the first time that I see this called
> is during the paging_init() function and passed to free_area_init().  The
> memory map size is determined from this variable.  It memory map will
> extend to the end of physical memory (what used to be mips_memory_ upper).
> Do I determine the max_low_pfn by calculating the available memory and
> subtract the size of the kernel?  How does the variable "start" play into
> this equation?  Are they the same?  Any help would be greatly appreciated.

The max_low_pfn variable is the number of `normal' memory pages.  Normal
as opposed to high memory which we don't currently don't support on MIPS.
That is for contiguous memory starting at physical address zero it's
value equals available_memory / PAGE_SIZE.

The value of max_low_pfn is set by a call to init_bootmem.  A typical
setup could look like below.  Mb in this example is the number of
available megabytes of memory.  You may simplify this somewhat more,
it's derived from the Origin code.

        free_start = PFN_ALIGN(&_end) - PAGE_OFFSET;
        free_end = PAGE_OFFSET + (mb << 20);
        start_pfn = PFN_UP((unsigned long)&_end - PAGE_OFFSET);

        /* Register all the contiguous memory with the bootmem allocator
           and free it.  Be careful about the bootmem freemap.  */
        bootmap_size = init_bootmem(start_pfn, mb << (20 - PAGE_SHIFT));

        /* Free the entire available memory after the _end symbol.  */
        free_bootmem(__pa(free_start), (mb << 20) - __pa(free_start));

        /* We also did free the memory where the bootmap is stored,
           reserve it again. */
        reserve_bootmem(__pa(free_start), bootmap_size);

        printk("Found %ldmb of memory.\n", mb);


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