aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7d20b25c58fc..449841413cf1 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -15,6 +15,7 @@
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/debug_locks.h> 17#include <linux/debug_locks.h>
18#include <linux/backing-dev.h>
18 19
19struct mempolicy; 20struct mempolicy;
20struct anon_vma; 21struct anon_vma;
@@ -810,6 +811,39 @@ struct shrinker;
810extern struct shrinker *set_shrinker(int, shrinker_t); 811extern struct shrinker *set_shrinker(int, shrinker_t);
811extern void remove_shrinker(struct shrinker *shrinker); 812extern void remove_shrinker(struct shrinker *shrinker);
812 813
814/*
815 * Some shared mappigns will want the pages marked read-only
816 * to track write events. If so, we'll downgrade vm_page_prot
817 * to the private version (using protection_map[] without the
818 * VM_SHARED bit).
819 */
820static inline int vma_wants_writenotify(struct vm_area_struct *vma)
821{
822 unsigned int vm_flags = vma->vm_flags;
823
824 /* If it was private or non-writable, the write bit is already clear */
825 if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
826 return 0;
827
828 /* The backer wishes to know when pages are first written to? */
829 if (vma->vm_ops && vma->vm_ops->page_mkwrite)
830 return 1;
831
832 /* The open routine did something to the protections already? */
833 if (pgprot_val(vma->vm_page_prot) !=
834 pgprot_val(protection_map[vm_flags &
835 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
836 return 0;
837
838 /* Specialty mapping? */
839 if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
840 return 0;
841
842 /* Can the mapping track the dirty pages? */
843 return vma->vm_file && vma->vm_file->f_mapping &&
844 mapping_cap_account_dirty(vma->vm_file->f_mapping);
845}
846
813extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); 847extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl));
814 848
815int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); 849int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);