ia64/xen-unstable

changeset 2463:261f532059ea

bitkeeper revision 1.1159.1.141 (413f74fcTwJtxfSqPOLD17o7tsdJbg)

Freed PTEs now pass through the TLB-gathering mechanism, as is correct.
We hook them back off into the pte caching allocator using the
SetForeignHeap() mechanism that I added for the network backend.
author kaf24@freefall.cl.cam.ac.uk
date Wed Sep 08 21:09:16 2004 +0000 (2004-09-08)
parents 4b6481c1b7f4
children eab6988779a6
files linux-2.6.8.1-xen-sparse/arch/xen/Kconfig linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h
line diff
     1.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig	Wed Sep 08 20:16:51 2004 +0000
     1.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig	Wed Sep 08 21:09:16 2004 +0000
     1.3 @@ -45,8 +45,7 @@ endmenu
     1.4  
     1.5  config FOREIGN_PAGES
     1.6  	bool
     1.7 -	default y if XEN_PHYSDEV_ACCESS
     1.8 -	default n if !XEN_PHYSDEV_ACCESS
     1.9 +	default y
    1.10  
    1.11  config PAGESIZED_SKBS
    1.12  	bool
     2.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig	Wed Sep 08 20:16:51 2004 +0000
     2.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig	Wed Sep 08 21:09:16 2004 +0000
     2.3 @@ -11,7 +11,7 @@ CONFIG_NO_IDLE_HZ=y
     2.4  # CONFIG_XEN_PRIVILEGED_GUEST is not set
     2.5  # CONFIG_XEN_PHYSDEV_ACCESS is not set
     2.6  CONFIG_XEN_WRITABLE_PAGETABLES=y
     2.7 -# CONFIG_FOREIGN_PAGES is not set
     2.8 +CONFIG_FOREIGN_PAGES=y
     2.9  # CONFIG_PAGESIZED_SKBS is not set
    2.10  CONFIG_X86=y
    2.11  # CONFIG_X86_64 is not set
     3.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c	Wed Sep 08 20:16:51 2004 +0000
     3.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c	Wed Sep 08 21:09:16 2004 +0000
     3.3 @@ -187,6 +187,9 @@ pte_t *pte_alloc_one_kernel(struct mm_st
     3.4  
     3.5  void pte_ctor(void *pte, kmem_cache_t *cache, unsigned long unused)
     3.6  {
     3.7 +	struct page *page = virt_to_page(pte);
     3.8 +	SetPageForeign(page, pte_free);
     3.9 +	set_page_count(page, 1);
    3.10  
    3.11  	clear_page(pte);
    3.12  	__make_page_readonly(pte);
    3.13 @@ -196,6 +199,8 @@ void pte_ctor(void *pte, kmem_cache_t *c
    3.14  
    3.15  void pte_dtor(void *pte, kmem_cache_t *cache, unsigned long unused)
    3.16  {
    3.17 +	struct page *page = virt_to_page(pte);
    3.18 +	ClearPageForeign(page);
    3.19  
    3.20  	queue_pte_unpin(virt_to_phys(pte));
    3.21  	__make_page_writable(pte);
    3.22 @@ -225,6 +230,20 @@ struct page *pte_alloc_one(struct mm_str
    3.23  	return NULL;
    3.24  }
    3.25  
    3.26 +void pte_free(struct page *pte)
    3.27 +{
    3.28 +	set_page_count(pte, 1);
    3.29 +#ifdef CONFIG_HIGHPTE
    3.30 +	if (pte < highmem_start_page)
    3.31 +#endif
    3.32 +		kmem_cache_free(pte_cache,
    3.33 +				phys_to_virt(page_to_pseudophys(pte)));
    3.34 +#ifdef CONFIG_HIGHPTE
    3.35 +	else
    3.36 +		__free_page(pte);
    3.37 +#endif
    3.38 +}
    3.39 +
    3.40  void pmd_ctor(void *pmd, kmem_cache_t *cache, unsigned long flags)
    3.41  {
    3.42  	memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
     4.1 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h	Wed Sep 08 20:16:51 2004 +0000
     4.2 +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h	Wed Sep 08 21:09:16 2004 +0000
     4.3 @@ -36,21 +36,9 @@ static inline void pte_free_kernel(pte_t
     4.4  	flush_page_update_queue();
     4.5  }
     4.6  
     4.7 -static inline void pte_free(struct page *pte)
     4.8 -{
     4.9 -#ifdef CONFIG_HIGHPTE
    4.10 -	if (pte < highmem_start_page)
    4.11 -#endif
    4.12 -		kmem_cache_free(pte_cache,
    4.13 -				phys_to_virt(page_to_pseudophys(pte)));
    4.14 -#ifdef CONFIG_HIGHPTE
    4.15 -	else
    4.16 -		__free_page(pte);
    4.17 -#endif
    4.18 -}
    4.19 +extern void pte_free(struct page *pte);
    4.20  
    4.21 -
    4.22 -#define __pte_free_tlb(tlb,pte)		pte_free(pte)
    4.23 +#define __pte_free_tlb(tlb,pte)	tlb_remove_page((tlb),(pte))
    4.24  
    4.25  /*
    4.26   * allocating and freeing a pmd is trivial: the 1-entry pmd is