Skip to content

Commit

Permalink
x86, 32-bit: refactor find_low_pfn_range()
Browse files Browse the repository at this point in the history
Impact: cleanup

Make the max_low_pfn logic a bit more standard between
lowmem_pfn_init() and highmem_pfn_init().

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Feb 12, 2009
1 parent 4769843 commit d88316c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions arch/x86/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@ early_param("highmem", parse_highmem);
*/
void __init lowmem_pfn_init(void)
{
/* max_low_pfn is 0, we already have early_res support */
max_low_pfn = max_pfn;

if (highmem_pages == -1)
highmem_pages = 0;
#ifdef CONFIG_HIGHMEM
Expand Down Expand Up @@ -720,6 +723,8 @@ void __init lowmem_pfn_init(void)
*/
void __init highmem_pfn_init(void)
{
max_low_pfn = MAXMEM_PFN;

if (highmem_pages == -1)
highmem_pages = max_pfn - MAXMEM_PFN;

Expand All @@ -732,7 +737,6 @@ void __init highmem_pfn_init(void)
pages_to_mb(highmem_pages));
highmem_pages = 0;
}
max_low_pfn = MAXMEM_PFN;
#ifndef CONFIG_HIGHMEM
/* Maximum memory usable is what is directly addressable */
printk(KERN_WARNING "Warning only %ldMB will be used.\n", MAXMEM>>20);
Expand All @@ -758,13 +762,10 @@ void __init find_low_pfn_range(void)
{
/* it could update max_pfn */

/* max_low_pfn is 0, we already have early_res support */
max_low_pfn = max_pfn;

if (max_low_pfn > MAXMEM_PFN)
highmem_pfn_init();
else
if (max_pfn <= MAXMEM_PFN)
lowmem_pfn_init();
else
highmem_pfn_init();
}

#ifndef CONFIG_NEED_MULTIPLE_NODES
Expand Down

0 comments on commit d88316c

Please sign in to comment.