aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/mm.h2
-rw-r--r--mm/memory.c23
2 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5e2c8af49998..335288bff1b7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -744,6 +744,8 @@ struct zap_details {
744struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, 744struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
745 pte_t pte); 745 pte_t pte);
746 746
747int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
748 unsigned long size);
747unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, 749unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
748 unsigned long size, struct zap_details *); 750 unsigned long size, struct zap_details *);
749unsigned long unmap_vmas(struct mmu_gather **tlb, 751unsigned long unmap_vmas(struct mmu_gather **tlb,
diff --git a/mm/memory.c b/mm/memory.c
index 67f0ab9077d9..6793b9c68107 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -994,6 +994,29 @@ unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
994 return end; 994 return end;
995} 995}
996 996
997/**
998 * zap_vma_ptes - remove ptes mapping the vma
999 * @vma: vm_area_struct holding ptes to be zapped
1000 * @address: starting address of pages to zap
1001 * @size: number of bytes to zap
1002 *
1003 * This function only unmaps ptes assigned to VM_PFNMAP vmas.
1004 *
1005 * The entire address range must be fully contained within the vma.
1006 *
1007 * Returns 0 if successful.
1008 */
1009int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
1010 unsigned long size)
1011{
1012 if (address < vma->vm_start || address + size > vma->vm_end ||
1013 !(vma->vm_flags & VM_PFNMAP))
1014 return -1;
1015 zap_page_range(vma, address, size, NULL);
1016 return 0;
1017}
1018EXPORT_SYMBOL_GPL(zap_vma_ptes);
1019
997/* 1020/*
998 * Do a quick page-table lookup for a single page. 1021 * Do a quick page-table lookup for a single page.
999 */ 1022 */