[PATCH] initialize end of memory variables as early as possible
authorJan Beulich <jbeulich@novell.com>
Tue, 26 Sep 2006 08:52:31 +0000 (10:52 +0200)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 26 Sep 2006 08:52:31 +0000 (10:52 +0200)
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: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andi Kleen <ak@suse.de>
arch/x86_64/kernel/e820.c
arch/x86_64/kernel/setup.c
arch/x86_64/mm/init.c

index d6d7f731f6f0edd78509fca24599caeec8fd9745..1362aad4f3aa20a7077ceb5546942fddc62d7e2e 100644 (file)
@@ -40,7 +40,7 @@ unsigned long end_pfn_map;
 /* 
  * 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;
 
index aab4bd66aa0de2ab0d8ce3eb9e7e2f03d112f355..ddc3b2d9a1654e913b60705706b53670a25d7ef7 100644 (file)
@@ -554,7 +554,7 @@ void __init setup_arch(char **cmdline_p)
         * we are rounding upwards:
         */
        end_pfn = e820_end_of_ram();
-       num_physpages = end_pfn;                /* for pfn_valid */
+       num_physpages = end_pfn;
 
        check_efer();
 
@@ -574,6 +574,11 @@ void __init setup_arch(char **cmdline_p)
        acpi_boot_table_init();
 #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
        /*
         * Parse SRAT to discover nodes.
index d14fb2dfbfc4a742b399882482a877b9c2db9428..d40134bd639928d370b32fd1bd9cd28e600e8147 100644 (file)
@@ -597,12 +597,6 @@ void __init mem_init(void)
 
        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 */
        memset(empty_zero_page, 0, PAGE_SIZE);