direct-io.hg

changeset 14679:7180d2e61f92

linux: Add a hook before a page table entry is cleared, for use with
the grant-table device.

Signed-off-by: Derek Murray <Derek.Murray@cl.cam.ac.uk>
author Keir Fraser <keir@xensource.com>
date Sat Mar 31 12:42:02 2007 +0100 (2007-03-31)
parents 2de267ba9a76
children 5e65a86c8982
files linux-2.6-xen-sparse/include/linux/mm.h linux-2.6-xen-sparse/mm/memory.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/include/linux/mm.h	Sat Mar 31 12:26:04 2007 +0100
     1.2 +++ b/linux-2.6-xen-sparse/include/linux/mm.h	Sat Mar 31 12:42:02 2007 +0100
     1.3 @@ -205,6 +205,11 @@ struct vm_operations_struct {
     1.4  	/* notification that a previously read-only page is about to become
     1.5  	 * writable, if an error is returned it will cause a SIGBUS */
     1.6  	int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
     1.7 +	/* Area-specific function for clearing the PTE at @ptep. Returns the
     1.8 +	 * original value of @ptep. */
     1.9 +	pte_t (*ptep_get_and_clear_full)(struct vm_area_struct *vma, 
    1.10 +					 unsigned long addr, pte_t *ptep, 
    1.11 +					 int is_fullmm);
    1.12  #ifdef CONFIG_NUMA
    1.13  	int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
    1.14  	struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
     2.1 --- a/linux-2.6-xen-sparse/mm/memory.c	Sat Mar 31 12:26:04 2007 +0100
     2.2 +++ b/linux-2.6-xen-sparse/mm/memory.c	Sat Mar 31 12:42:02 2007 +0100
     2.3 @@ -659,8 +659,15 @@ static unsigned long zap_pte_range(struc
     2.4  				     page->index > details->last_index))
     2.5  					continue;
     2.6  			}
     2.7 -			ptent = ptep_get_and_clear_full(mm, addr, pte,
     2.8 -							tlb->fullmm);
     2.9 +			if (unlikely(vma->vm_ops && 
    2.10 +				     vma->vm_ops->ptep_get_and_clear_full))
    2.11 +				ptent = vma->vm_ops->
    2.12 +					ptep_get_and_clear_full(vma, addr,
    2.13 +								pte,
    2.14 +								tlb->fullmm);
    2.15 +			else
    2.16 +				ptent = ptep_get_and_clear_full(mm, addr, pte,
    2.17 +								tlb->fullmm);
    2.18  			tlb_remove_tlb_entry(tlb, pte, addr);
    2.19  			if (unlikely(!page))
    2.20  				continue;
    2.21 @@ -755,6 +762,7 @@ static unsigned long unmap_page_range(st
    2.22  		details = NULL;
    2.23  
    2.24  	BUG_ON(addr >= end);
    2.25 +
    2.26  	tlb_start_vma(tlb, vma);
    2.27  	pgd = pgd_offset(vma->vm_mm, addr);
    2.28  	do {