[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] linux/i386: allow CONFIG_HIGHPTE on i386
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Date 1168597734 0 # Node ID 648e58e31c26c200e17c77c44e9658385f65db04 # Parent 7c5c72a0283f433949d9da82ae197da4f27861eb linux/i386: allow CONFIG_HIGHPTE on i386 While, as discussed, the performance impact of this option is certainly higher than on native Linux, the option should not be entirely disallowed if people want to sacrifice performance for less lowmem pressure. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx> --- linux-2.6-xen-sparse/arch/i386/Kconfig | 2 linux-2.6-xen-sparse/arch/i386/mm/highmem-xen.c | 1 linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c | 30 ++++++++--- linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgalloc.h | 2 4 files changed, 27 insertions(+), 8 deletions(-) diff -r 7c5c72a0283f -r 648e58e31c26 linux-2.6-xen-sparse/arch/i386/Kconfig --- a/linux-2.6-xen-sparse/arch/i386/Kconfig Fri Jan 12 10:22:36 2007 +0000 +++ b/linux-2.6-xen-sparse/arch/i386/Kconfig Fri Jan 12 10:28:54 2007 +0000 @@ -594,7 +594,7 @@ config HAVE_ARCH_EARLY_PFN_TO_NID config HIGHPTE bool "Allocate 3rd-level pagetables from highmem" - depends on (HIGHMEM4G || HIGHMEM64G) && !X86_XEN + depends on HIGHMEM4G || HIGHMEM64G help The VM uses one page table entry for each page of physical memory. For systems with a lot of RAM, this can be wasteful of precious diff -r 7c5c72a0283f -r 648e58e31c26 linux-2.6-xen-sparse/arch/i386/mm/highmem-xen.c --- a/linux-2.6-xen-sparse/arch/i386/mm/highmem-xen.c Fri Jan 12 10:22:36 2007 +0000 +++ b/linux-2.6-xen-sparse/arch/i386/mm/highmem-xen.c Fri Jan 12 10:28:54 2007 +0000 @@ -129,5 +129,6 @@ EXPORT_SYMBOL(kmap); EXPORT_SYMBOL(kmap); EXPORT_SYMBOL(kunmap); EXPORT_SYMBOL(kmap_atomic); +EXPORT_SYMBOL(kmap_atomic_pte); EXPORT_SYMBOL(kunmap_atomic); EXPORT_SYMBOL(kmap_atomic_to_page); diff -r 7c5c72a0283f -r 648e58e31c26 linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c --- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c Fri Jan 12 10:22:36 2007 +0000 +++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c Fri Jan 12 10:28:54 2007 +0000 @@ -238,23 +238,41 @@ struct page *pte_alloc_one(struct mm_str #ifdef CONFIG_HIGHPTE pte = alloc_pages(GFP_KERNEL|__GFP_HIGHMEM|__GFP_REPEAT|__GFP_ZERO, 0); + if (pte && PageHighMem(pte)) { + struct mmuext_op op; + + kmap_flush_unused(); + op.cmd = MMUEXT_PIN_L1_TABLE; + op.arg1.mfn = pfn_to_mfn(page_to_pfn(pte)); + BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); + } #else pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); +#endif if (pte) { SetPageForeign(pte, pte_free); set_page_count(pte, 1); } -#endif return pte; } void pte_free(struct page *pte) { - unsigned long va = (unsigned long)__va(page_to_pfn(pte)<<PAGE_SHIFT); - - if (!pte_write(*virt_to_ptep(va))) - BUG_ON(HYPERVISOR_update_va_mapping( - va, pfn_pte(page_to_pfn(pte), PAGE_KERNEL), 0)); + unsigned long pfn = page_to_pfn(pte); + + if (!PageHighMem(pte)) { + unsigned long va = (unsigned long)__va(pfn << PAGE_SHIFT); + + if (!pte_write(*virt_to_ptep(va))) + BUG_ON(HYPERVISOR_update_va_mapping( + va, pfn_pte(pfn, PAGE_KERNEL), 0)); + } else { + struct mmuext_op op; + + op.cmd = MMUEXT_UNPIN_TABLE; + op.arg1.mfn = pfn_to_mfn(pfn); + BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); + } ClearPageForeign(pte); set_page_count(pte, 1); diff -r 7c5c72a0283f -r 648e58e31c26 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgalloc.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgalloc.h Fri Jan 12 10:22:36 2007 +0000 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgalloc.h Fri Jan 12 10:28:54 2007 +0000 @@ -42,7 +42,7 @@ static inline void pte_free_kernel(pte_t static inline void pte_free_kernel(pte_t *pte) { free_page((unsigned long)pte); - make_page_writable(pte, XENFEAT_writable_page_tables); + make_lowmem_page_writable(pte, XENFEAT_writable_page_tables); } extern void pte_free(struct page *pte); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |