Commit d88316c2 authored by Ingo Molnar's avatar Ingo Molnar

x86, 32-bit: refactor find_low_pfn_range()

Impact: cleanup

Make the max_low_pfn logic a bit more standard between
lowmem_pfn_init() and highmem_pfn_init().
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 4769843b
...@@ -687,6 +687,9 @@ early_param("highmem", parse_highmem); ...@@ -687,6 +687,9 @@ early_param("highmem", parse_highmem);
*/ */
void __init lowmem_pfn_init(void) 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) if (highmem_pages == -1)
highmem_pages = 0; highmem_pages = 0;
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
...@@ -720,6 +723,8 @@ void __init lowmem_pfn_init(void) ...@@ -720,6 +723,8 @@ void __init lowmem_pfn_init(void)
*/ */
void __init highmem_pfn_init(void) void __init highmem_pfn_init(void)
{ {
max_low_pfn = MAXMEM_PFN;
if (highmem_pages == -1) if (highmem_pages == -1)
highmem_pages = max_pfn - MAXMEM_PFN; highmem_pages = max_pfn - MAXMEM_PFN;
...@@ -732,7 +737,6 @@ void __init highmem_pfn_init(void) ...@@ -732,7 +737,6 @@ void __init highmem_pfn_init(void)
pages_to_mb(highmem_pages)); pages_to_mb(highmem_pages));
highmem_pages = 0; highmem_pages = 0;
} }
max_low_pfn = MAXMEM_PFN;
#ifndef CONFIG_HIGHMEM #ifndef CONFIG_HIGHMEM
/* Maximum memory usable is what is directly addressable */ /* Maximum memory usable is what is directly addressable */
printk(KERN_WARNING "Warning only %ldMB will be used.\n", MAXMEM>>20); printk(KERN_WARNING "Warning only %ldMB will be used.\n", MAXMEM>>20);
...@@ -758,13 +762,10 @@ void __init find_low_pfn_range(void) ...@@ -758,13 +762,10 @@ void __init find_low_pfn_range(void)
{ {
/* it could update max_pfn */ /* it could update max_pfn */
/* max_low_pfn is 0, we already have early_res support */ if (max_pfn <= MAXMEM_PFN)
max_low_pfn = max_pfn;
if (max_low_pfn > MAXMEM_PFN)
highmem_pfn_init();
else
lowmem_pfn_init(); lowmem_pfn_init();
else
highmem_pfn_init();
} }
#ifndef CONFIG_NEED_MULTIPLE_NODES #ifndef CONFIG_NEED_MULTIPLE_NODES
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment