]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] x86_64: Recover 1MB of kernel memory
authorAndi Kleen <ak@suse.de>
Wed, 30 Aug 2006 17:37:12 +0000 (19:37 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 30 Aug 2006 23:05:15 +0000 (16:05 -0700)
Noticed by Jan Beulich.

When the kernel was moved from 1MB to 2MB in 2.6.17 the kernel reservation
code wasn't adjusted and it still reserved starting with 1MB. This means 1MB always
were lost.

This patch fixes this by reserving only starting with _text.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/e820.c
arch/x86_64/kernel/setup.c

index d81e3d6dd2417e7095a1204b79a5ae1b1e1fd481..764bf23c7103ff2de7ffcecff581910df8ae517e 100644 (file)
@@ -71,7 +71,11 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)
 #endif
        /* kernel code + 640k memory hole (later should not be needed, but 
           be paranoid for now) */
-       if (last >= 640*1024 && addr < __pa_symbol(&_end)) { 
+       if (last >= 640*1024 && addr < 1024*1024) {
+               *addrp = 1024*1024;
+               return 1;
+       }
+       if (last >= __pa_symbol(&_text) && last < __pa_symbol(&_end)) {
                *addrp = __pa_symbol(&_end);
                return 1;
        }
index 8a099ff1f8bc151cc4968ed63991258fcf00241e..34afad704824b10dd4348cb7b9246d9ea29421bf 100644 (file)
@@ -521,8 +521,6 @@ static void discover_ebda(void)
 
 void __init setup_arch(char **cmdline_p)
 {
-       unsigned long kernel_end;
-
        ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
        screen_info = SCREEN_INFO;
        edid_info = EDID_INFO;
@@ -596,8 +594,8 @@ void __init setup_arch(char **cmdline_p)
                                (table_end - table_start) << PAGE_SHIFT);
 
        /* reserve kernel */
-       kernel_end = round_up(__pa_symbol(&_end),PAGE_SIZE);
-       reserve_bootmem_generic(HIGH_MEMORY, kernel_end - HIGH_MEMORY);
+       reserve_bootmem_generic(__pa_symbol(&_text),
+                               __pa_symbol(&_end) - __pa_symbol(&_text));
 
        /*
         * reserve physical page 0 - it's a special BIOS page on many boxes,