Commit caff0710 authored by Jan Beulich's avatar Jan Beulich Committed by Andi Kleen

[PATCH] initialize end of memory variables as early as possible

While an earlier patch already did a small step into that direction,
this patch moves initialization of all memory end variables to as
early as possible, so that dependent code doesn't need to check
whether these variables have already been set.

Also, remove a misleading (perhaps just outdated) comment, and make
static a variable only used in a single file.
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent 44cc4526
...@@ -40,7 +40,7 @@ unsigned long end_pfn_map; ...@@ -40,7 +40,7 @@ unsigned long end_pfn_map;
/* /*
* Last pfn which the user wants to use. * Last pfn which the user wants to use.
*/ */
unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT; static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT;
extern struct resource code_resource, data_resource; extern struct resource code_resource, data_resource;
......
...@@ -554,7 +554,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -554,7 +554,7 @@ void __init setup_arch(char **cmdline_p)
* we are rounding upwards: * we are rounding upwards:
*/ */
end_pfn = e820_end_of_ram(); end_pfn = e820_end_of_ram();
num_physpages = end_pfn; /* for pfn_valid */ num_physpages = end_pfn;
check_efer(); check_efer();
...@@ -574,6 +574,11 @@ void __init setup_arch(char **cmdline_p) ...@@ -574,6 +574,11 @@ void __init setup_arch(char **cmdline_p)
acpi_boot_table_init(); acpi_boot_table_init();
#endif #endif
/* How many end-of-memory variables you have, grandma! */
max_low_pfn = end_pfn;
max_pfn = end_pfn;
high_memory = (void *)__va(end_pfn * PAGE_SIZE - 1) + 1;
#ifdef CONFIG_ACPI_NUMA #ifdef CONFIG_ACPI_NUMA
/* /*
* Parse SRAT to discover nodes. * Parse SRAT to discover nodes.
......
...@@ -597,12 +597,6 @@ void __init mem_init(void) ...@@ -597,12 +597,6 @@ void __init mem_init(void)
pci_iommu_alloc(); pci_iommu_alloc();
/* How many end-of-memory variables you have, grandma! */
max_low_pfn = end_pfn;
max_pfn = end_pfn;
num_physpages = end_pfn;
high_memory = (void *) __va(end_pfn * PAGE_SIZE);
/* clear the zero-page */ /* clear the zero-page */
memset(empty_zero_page, 0, PAGE_SIZE); memset(empty_zero_page, 0, PAGE_SIZE);
......
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