[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1235785882-17580-3-git-send-email-jeremy@goop.org>
Date: Fri, 27 Feb 2009 17:51:19 -0800
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: the arch/x86 maintainers <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
Subject: [PATCH] x86: reserve brk earlier
From: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
We need to reserve the brk segment before doing the pagetable
construction, so that it doesn't allocate the same memory.
Also, pre-initialize brk to _end (but still leave init_brk for cases
where that's not correct, like i386 (for now) and Xen).
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
---
arch/x86/kernel/head64.c | 2 --
arch/x86/kernel/setup.c | 16 ++++++++++++----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 4b29802..f5b2722 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -91,8 +91,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
if (console_loglevel == 10)
early_printk("Kernel alive\n");
- init_brk((unsigned long)&_end);
-
x86_64_start_reservations(real_mode_data);
}
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 6a21423..c246dc4 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -113,7 +113,8 @@
#endif
unsigned int boot_cpu_id __read_mostly;
-__initdata unsigned long _brk_start, _brk_end;
+__initdata unsigned long _brk_start = (unsigned long)&_end;
+__initdata unsigned long _brk_end = (unsigned long)&_end;
#ifdef CONFIG_X86_64
int default_cpu_present_to_apicid(int mps_cpu)
@@ -356,6 +357,14 @@ void * __init extend_brk(size_t size, size_t align)
return ret;
}
+static void __init reserve_brk(void)
+{
+ if (_brk_end > _brk_start)
+ reserve_early(__pa(_brk_start), __pa(_brk_end), "BRK");
+
+ _brk_end = _brk_start = 0xdeadb00c + POISON_POINTER_DELTA;
+}
+
static void __init reserve_initrd(void)
{
u64 ramdisk_image = boot_params.hdr.ramdisk_image;
@@ -856,6 +865,8 @@ void __init setup_arch(char **cmdline_p)
setup_bios_corruption_check();
#endif
+ reserve_brk();
+
/* max_pfn_mapped is updated here */
max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
max_pfn_mapped = max_low_pfn_mapped;
@@ -898,9 +909,6 @@ void __init setup_arch(char **cmdline_p)
acpi_numa_init();
#endif
- if (_brk_end > _brk_start)
- reserve_early(__pa(_brk_start), __pa(_brk_end), "BRK");
-
initmem_init(0, max_pfn);
#ifdef CONFIG_ACPI_SLEEP
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists