[1/7] Xen VMM #3: add ptep_establish_new to make va available

From: Ian Pratt (Ian.Pratt_at_cl.cam.ac.uk)
Date: 11/30/04

  • Next message: Neil Brown: "Re: raid1 oops in 2.6.9 (debian package 2.6.9-1-686-smp)"
    To: linux-kernel@vger.kernel.org
    Date:	Tue, 30 Nov 2004 02:06:02 +0000
    
    

    This patch adds 'ptep_establish_new', in keeping with the
    existing 'ptep_establish', but for use where a mapping is being
    established where there was previously none present. This
    function is useful (rather than just using set_pte) because
    having the virtual address available enables a very important
    optimisation for arch-xen. We introduce
    HAVE_ARCH_PTEP_ESTABLISH_NEW and define a generic implementation
    in asm-generic/pgtable.h, following the pattern of the existing
    ptep_establish.

    Signed-off-by: ian.pratt@cl.cam.ac.uk

    ---
    diff -Nurp pristine-linux-2.6.10-rc2/include/asm-generic/pgtable.h tmp-linux-2.6.10-rc2-xen.patch/include/asm-generic/pgtable.h
    --- pristine-linux-2.6.10-rc2/include/asm-generic/pgtable.h	2004-10-18 22:53:46.000000000 +0100
    +++ tmp-linux-2.6.10-rc2-xen.patch/include/asm-generic/pgtable.h	2004-11-30 00:41:24.000000000 +0000
    @@ -42,6 +42,16 @@ do {				  					  \
     } while (0)
     #endif
     
    +#ifndef __HAVE_ARCH_PTEP_ESTABLISH_NEW
    +/*
    + * Establish a mapping where none previously existed
    + */
    +#define ptep_establish_new(__vma, __address, __ptep, __entry)		\
    +do {									\
    +	set_pte(__ptep, __entry);					\
    +} while (0)
    +#endif
    +
     #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
     static inline int ptep_test_and_clear_young(pte_t *ptep)
     {
    diff -Nurp pristine-linux-2.6.10-rc2/mm/memory.c tmp-linux-2.6.10-rc2-xen.patch/mm/memory.c
    --- pristine-linux-2.6.10-rc2/mm/memory.c	2004-11-30 01:20:25.000000000 +0000
    +++ tmp-linux-2.6.10-rc2-xen.patch/mm/memory.c	2004-11-30 00:41:24.000000000 +0000
    @@ -1472,7 +1472,7 @@ do_anonymous_page(struct mm_struct *mm, 
     		page_add_anon_rmap(page, vma, addr);
     	}
     
    -	set_pte(page_table, entry);
    +	ptep_establish_new(vma, addr, page_table, entry);
     	pte_unmap(page_table);
     
     	/* No need to invalidate - it was non-present before */
    @@ -1577,7 +1577,7 @@ retry:
     		entry = mk_pte(new_page, vma->vm_page_prot);
     		if (write_access)
     			entry = maybe_mkwrite(pte_mkdirty(entry), vma);
    -		set_pte(page_table, entry);
    +		ptep_establish_new(vma, address, page_table, entry);
     		if (anon) {
     			lru_cache_add_active(new_page);
     			page_add_anon_rmap(new_page, vma, address);
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Neil Brown: "Re: raid1 oops in 2.6.9 (debian package 2.6.9-1-686-smp)"

    Relevant Pages

    • Re: [PATCH] NOMMU: Separate out VMAs
      ... extern int maps_protect; ... * display a single VMA to a sequenced file ... * A region containing a mapping of a non-memory backed file under NOMMU ...
      (Linux-Kernel)
    • Re: [PATCH] NOMMU: Separate out VMAs
      ... * display a single VMA to a sequenced file ... * A region containing a mapping of a non-memory backed file under NOMMU ... +extern unsigned int kobjsize(const void *objp); ...
      (Linux-Kernel)
    • [PATCH] NOMMU: Separate out VMAs
      ... extern int maps_protect; ... * display a single VMA to a sequenced file ... * A region containing a mapping of a non-memory backed file under NOMMU ...
      (Linux-Kernel)
    • Re: [PATCH, RFD] Unbreaking nommu mmap, v2
      ... A new struct is introduced to track a mapped region and to remember ... end up with overlapping VMAs within the tree, ... * A region containing a mapping of a non-memory backed file under NOMMU ...
      (Linux-Kernel)
    • Re: Linux 2.6.7-rc1
      ... > allows reverse page mapping by keeping track of which vma (and offset) ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)