diff options
author | Vivek Goyal <vgoyal@in.ibm.com> | 2007-05-02 13:27:07 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:07 -0400 |
commit | 0dbf7028c0c1f266c9631139450a1502d3cd457e (patch) | |
tree | 2616edcd32d92b6539d2810fd3043b054baabb92 /arch/i386/mm/init.c | |
parent | 1b29c1643c0d82512477ccd97dc290198fe23e22 (diff) |
[PATCH] x86: __pa and __pa_symbol address space separation
Currently __pa_symbol is for use with symbols in the kernel address
map and __pa is for use with pointers into the physical memory map.
But the code is implemented so you can usually interchange the two.
__pa which is much more common can be implemented much more cheaply
if it is it doesn't have to worry about any other kernel address
spaces. This is especially true with a relocatable kernel as
__pa_symbol needs to peform an extra variable read to resolve
the address.
There is a third macro that is added for the vsyscall data
__pa_vsymbol for finding the physical addesses of vsyscall pages.
Most of this patch is simply sorting through the references to
__pa or __pa_symbol and using the proper one. A little of
it is continuing to use a physical address when we have it
instead of recalculating it several times.
swapper_pgd is now NULL. leave_mm now uses init_mm.pgd
and init_mm.pgd is initialized at boot (instead of compile time)
to the physmem virtual mapping of init_level4_pgd. The
physical address changed.
Except for the for EMPTY_ZERO page all of the remaining references
to __pa_symbol appear to be during kernel initialization. So this
should reduce the cost of __pa in the common case, even on a relocated
kernel.
As this is technically a semantic change we need to be on the lookout
for anything I missed. But it works for me (tm).
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/i386/mm/init.c')
-rw-r--r-- | arch/i386/mm/init.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index ae436882af7a..23be1b0aafa4 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c | |||
@@ -774,10 +774,11 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
774 | unsigned long addr; | 774 | unsigned long addr; |
775 | 775 | ||
776 | for (addr = begin; addr < end; addr += PAGE_SIZE) { | 776 | for (addr = begin; addr < end; addr += PAGE_SIZE) { |
777 | ClearPageReserved(virt_to_page(addr)); | 777 | struct page *page = pfn_to_page(addr >> PAGE_SHIFT); |
778 | init_page_count(virt_to_page(addr)); | 778 | ClearPageReserved(page); |
779 | memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); | 779 | init_page_count(page); |
780 | free_page(addr); | 780 | memset(page_address(page), POISON_FREE_INITMEM, PAGE_SIZE); |
781 | __free_page(page); | ||
781 | totalram_pages++; | 782 | totalram_pages++; |
782 | } | 783 | } |
783 | printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10); | 784 | printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10); |
@@ -786,14 +787,14 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
786 | void free_initmem(void) | 787 | void free_initmem(void) |
787 | { | 788 | { |
788 | free_init_pages("unused kernel memory", | 789 | free_init_pages("unused kernel memory", |
789 | (unsigned long)(&__init_begin), | 790 | __pa_symbol(&__init_begin), |
790 | (unsigned long)(&__init_end)); | 791 | __pa_symbol(&__init_end)); |
791 | } | 792 | } |
792 | 793 | ||
793 | #ifdef CONFIG_BLK_DEV_INITRD | 794 | #ifdef CONFIG_BLK_DEV_INITRD |
794 | void free_initrd_mem(unsigned long start, unsigned long end) | 795 | void free_initrd_mem(unsigned long start, unsigned long end) |
795 | { | 796 | { |
796 | free_init_pages("initrd memory", start, end); | 797 | free_init_pages("initrd memory", __pa(start), __pa(end)); |
797 | } | 798 | } |
798 | #endif | 799 | #endif |
799 | 800 | ||