aboutsummaryrefslogtreecommitdiffstats
path: root/linux-2.6-xen-sparse
diff options
context:
space:
mode:
authorKeir Fraser <keir@xensource.com>2007-03-31 12:42:02 +0100
committerKeir Fraser <keir@xensource.com>2007-03-31 12:42:02 +0100
commit7fd0f937ba5af29fb1cfe7622ff4aea6b4133639 (patch)
treee4b2b02715b85acc83e69e8f37bcdbd67935883b /linux-2.6-xen-sparse
parent29f999ff69fea4aa73d3a85c399d78159db876d7 (diff)
downloadxen-7fd0f937ba5af29fb1cfe7622ff4aea6b4133639.tar.gz
xen-7fd0f937ba5af29fb1cfe7622ff4aea6b4133639.tar.bz2
xen-7fd0f937ba5af29fb1cfe7622ff4aea6b4133639.zip
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>
Diffstat (limited to 'linux-2.6-xen-sparse')
-rw-r--r--linux-2.6-xen-sparse/include/linux/mm.h5
-rw-r--r--linux-2.6-xen-sparse/mm/memory.c12
2 files changed, 15 insertions, 2 deletions
diff --git a/linux-2.6-xen-sparse/include/linux/mm.h b/linux-2.6-xen-sparse/include/linux/mm.h
index 1368b8450a..19654229cc 100644
--- a/linux-2.6-xen-sparse/include/linux/mm.h
+++ b/linux-2.6-xen-sparse/include/linux/mm.h
@@ -205,6 +205,11 @@ struct vm_operations_struct {
/* notification that a previously read-only page is about to become
* writable, if an error is returned it will cause a SIGBUS */
int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
+ /* Area-specific function for clearing the PTE at @ptep. Returns the
+ * original value of @ptep. */
+ pte_t (*ptep_get_and_clear_full)(struct vm_area_struct *vma,
+ unsigned long addr, pte_t *ptep,
+ int is_fullmm);
#ifdef CONFIG_NUMA
int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
diff --git a/linux-2.6-xen-sparse/mm/memory.c b/linux-2.6-xen-sparse/mm/memory.c
index f55ed7dedc..4af5beccaa 100644
--- a/linux-2.6-xen-sparse/mm/memory.c
+++ b/linux-2.6-xen-sparse/mm/memory.c
@@ -659,8 +659,15 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
page->index > details->last_index))
continue;
}
- ptent = ptep_get_and_clear_full(mm, addr, pte,
- tlb->fullmm);
+ if (unlikely(vma->vm_ops &&
+ vma->vm_ops->ptep_get_and_clear_full))
+ ptent = vma->vm_ops->
+ ptep_get_and_clear_full(vma, addr,
+ pte,
+ tlb->fullmm);
+ else
+ ptent = ptep_get_and_clear_full(mm, addr, pte,
+ tlb->fullmm);
tlb_remove_tlb_entry(tlb, pte, addr);
if (unlikely(!page))
continue;
@@ -755,6 +762,7 @@ static unsigned long unmap_page_range(struct mmu_gather *tlb,
details = NULL;
BUG_ON(addr >= end);
+
tlb_start_vma(tlb, vma);
pgd = pgd_offset(vma->vm_mm, addr);
do {