refactor i386 memory setup
PATCH 1/3 refactor i386 memory setup
Refactor the i386 default and CONFIG_DISCONTIG_MEM setup_memory() functions to share the common bootmem initialisation code. This code is intended to be identical, but there are currently some fixes applied to one and not the other. This patch extracts this common initialisation code.
Signed-off-by Andy Whitcroft <[email protected]>
Signed-off-by Dave Hansen <[email protected]>
---
memhotplug-dave/arch/i386/kernel/setup.c | 28 ++++--- memhotplug-dave/arch/i386/mm/discontig.c | 118 +------------------------------ 2 files changed, 21 insertions(+), 125 deletions(-)
arch/i386/kernel/setup.c renamed from arch/i386/kernel/setup.c~A1.1-refactor-setup_memory-i386 +17 -11
@@ -987,8 +987,6 @@ unsigned long __init find_max_low_pfn(voreturn max_low_pfn; } -#ifndef CONFIG_DISCONTIGMEM -/* * Free all available memory for boot time allocation. Used * as a callback function by efi_memory_walk()
@@ -1062,15 +1060,15 @@ static void __init reserve_ebda_region(vreserve_bootmem (addr,PAGE_SIZE ); } +#ifndef CONFIG_DISCONTIGMEM +void __init setup_bootmem_allocator (void );static unsigned long __init setup_memory (void ) { -unsigned long bootmap_size, start_pfn, max_low_pfn; -/* * partially used pages are not usable - thus * we are rounding upwards: */ - start_pfn =PFN_UP (init_pg_tables_end); + min_low_pfn =PFN_UP (init_pg_tables_end);find_max_pfn ();
@@ -1086,10 +1084,22 @@ static unsigned long __init setup_memory#endif printk (KERN_NOTICE "%ldMB LOWMEM available.\n" ,pages_to_mb (max_low_pfn)); + +setup_bootmem_allocator (); + + return max_low_pfn; +} +#else +extern unsigned long setup_memory (void ); +#endif /* !CONFIG_DISCONTIGMEM */ + +void __init setup_bootmem_allocator (void ) +{ +unsigned long bootmap_size;/* * Initialize the boot-time allocator (with low memory only): */ - bootmap_size =init_bootmem (start_pfn, max_low_pfn); + bootmap_size =init_bootmem (min_low_pfn, max_low_pfn);register_bootmem_low_pages (max_low_pfn);
@@ -1099,7 +1109,7 @@ static unsigned long __init setup_memory* the (very unlikely) case of us accidentally initializing the * bootmem allocator with an invalid RAM area. */ -reserve_bootmem (HIGH_MEMORY , (PFN_PHYS (start_pfn) + +reserve_bootmem (HIGH_MEMORY , (PFN_PHYS (min_low_pfn) + bootmap_size +PAGE_SIZE -1 ) - (HIGH_MEMORY ));/*
@@ -1161,11 +1171,7 @@ static unsigned long __init setup_memory reserve_bootmem(crashk_res.start, crashk_res.end - crashk_res.start + 1); }#endif -return max_low_pfn; } -#else -extern unsigned long setup_memory (void ); -#endif /* !CONFIG_DISCONTIGMEM */ /* * Request address space for all standard RAM and ROM resources
arch/i386/mm/discontig.c renamed from arch/i386/mm/discontig.c~A1.1-refactor-setup_memory-i386 +4 -114
144 lines not on this page · raw message
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>