so that max_low_pfn is not changed after it is set.
so we can move that early and out of initmem_init.
could call find_low_pfn_range just after max_pfn is set.
also could move reserve_initrd out of setup_bootmem_allocator
so 32bit is more like 64bit.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
static bool do_relocate_initrd = false;
-void __init reserve_initrd(void)
+static void __init reserve_initrd(void)
{
u64 ramdisk_image = boot_params.hdr.ramdisk_image;
u64 ramdisk_size = boot_params.hdr.ramdisk_size;
u64 ramdisk_end = ramdisk_image + ramdisk_size;
u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT;
u64 ramdisk_here;
+ u64 ramdisk_target;
if (!boot_params.hdr.type_of_loader ||
!ramdisk_image || !ramdisk_size)
initrd_start = 0;
- if (ramdisk_size >= end_of_lowmem/2) {
+ if (ramdisk_size >= (end_of_lowmem>>1)) {
free_early(ramdisk_image, ramdisk_end);
printk(KERN_ERR "initrd too large to handle, "
"disabling initrd\n");
}
/* We need to move the initrd down into lowmem */
- ramdisk_here = find_e820_area(min_low_pfn<<PAGE_SHIFT,
+ ramdisk_target = max_pfn_mapped<<PAGE_SHIFT;
+ ramdisk_here = find_e820_area(min(ramdisk_target, end_of_lowmem>>1),
end_of_lowmem, ramdisk_size,
PAGE_SIZE);
*/
void __init setup_arch(char **cmdline_p)
{
- unsigned long max_low_pfn;
-
memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
pre_setup_arch_hook();
early_cpu_init();
max_pfn = e820_end_of_ram();
}
+ find_low_pfn_range();
+
+ reserve_initrd();
+
dmi_scan_machine();
io_delay_init();
acpi_numa_init();
#endif
- max_low_pfn = initmem_init(0, max_pfn);
+ initmem_init(0, max_pfn);
#ifdef CONFIG_ACPI_SLEEP
/*
(ulong) node_remap_end_vaddr[nid]);
}
-unsigned long __init initmem_init(unsigned long start_pfn,
+void __init initmem_init(unsigned long start_pfn,
unsigned long end_pfn)
{
int nid;
- unsigned long system_start_pfn, system_max_low_pfn;
long kva_target_pfn;
/*
* and ZONE_HIGHMEM.
*/
- /* call find_max_low_pfn at first, it could update max_pfn */
- system_max_low_pfn = max_low_pfn = find_max_low_pfn();
-
remove_all_active_ranges();
get_memcfg_numa();
kva_pages = round_up(calculate_numa_remap_pages(), PTRS_PER_PTE);
- /* partially used pages are not usable - thus round upwards */
- system_start_pfn = min_low_pfn = PFN_UP(init_pg_tables_end);
-
kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE);
do {
kva_start_pfn = find_e820_area(kva_target_pfn<<PAGE_SHIFT,
"KVA PG");
#ifdef CONFIG_HIGHMEM
highstart_pfn = highend_pfn = max_pfn;
- if (max_pfn > system_max_low_pfn)
- highstart_pfn = system_max_low_pfn;
+ if (max_pfn > max_low_pfn)
+ highstart_pfn = max_low_pfn;
printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
pages_to_mb(highend_pfn - highstart_pfn));
num_physpages = highend_pfn;
high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
#else
- num_physpages = system_max_low_pfn;
- high_memory = (void *) __va(system_max_low_pfn * PAGE_SIZE - 1) + 1;
+ num_physpages = max_low_pfn;
+ high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
#endif
printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
- pages_to_mb(system_max_low_pfn));
- printk("min_low_pfn = %ld, max_low_pfn = %ld, highstart_pfn = %ld\n",
+ pages_to_mb(max_low_pfn));
+ printk("min_low_pfn = %ld, max_low_pfn = %ld, highstart_pfn = %ld\n",
min_low_pfn, max_low_pfn, highstart_pfn);
printk("Low memory ends at vaddr %08lx\n",
memset(NODE_DATA(0), 0, sizeof(struct pglist_data));
NODE_DATA(0)->bdata = &node0_bdata;
setup_bootmem_allocator();
- return max_low_pfn;
}
void __init zone_sizes_init(void)
/*
* Determine low and high memory ranges:
*/
-unsigned long __init find_max_low_pfn(void)
+void __init find_low_pfn_range(void)
{
- unsigned long max_low_pfn;
+ /* it could update max_pfn */
+
+ /*
+ * partially used pages are not usable - thus
+ * we are rounding upwards:
+ */
+ min_low_pfn = PFN_UP(init_pg_tables_end);
max_low_pfn = max_pfn;
if (max_low_pfn > MAXMEM_PFN) {
" kernel!\n");
#endif
}
- return max_low_pfn;
}
#ifndef CONFIG_NEED_MULTIPLE_NODES
-unsigned long __init initmem_init(unsigned long start_pfn,
+void __init initmem_init(unsigned long start_pfn,
unsigned long end_pfn)
{
- /*
- * partially used pages are not usable - thus
- * we are rounding upwards:
- */
- min_low_pfn = PFN_UP(init_pg_tables_end);
-
- max_low_pfn = find_max_low_pfn();
-
#ifdef CONFIG_HIGHMEM
highstart_pfn = highend_pfn = max_pfn;
if (max_pfn > max_low_pfn)
pages_to_mb(max_low_pfn));
setup_bootmem_allocator();
-
- return max_low_pfn;
}
void __init zone_sizes_init(void)
panic("Cannot find bootmem map of size %ld\n", bootmap_size);
reserve_early(bootmap, bootmap + bootmap_size, "BOOTMAP");
- reserve_initrd();
-
bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, max_low_pfn);
printk(KERN_INFO " mapped low ram: 0 - %08lx\n",
max_pfn_mapped<<PAGE_SHIFT);
#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
#define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE)
-extern unsigned long initmem_init(unsigned long, unsigned long);
+extern void find_low_pfn_range(void);
+extern void initmem_init(unsigned long, unsigned long);
extern void zone_sizes_init(void);
extern void setup_bootmem_allocator(void);
#include <asm/bootparam.h>
void reserve_standard_io_resources(void);
-void reserve_initrd(void);
-
#ifndef _SETUP