aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/mmap.c34
-rw-r--r--mm/oom_kill.c1
-rw-r--r--mm/vmstat.c1
3 files changed, 36 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 7afc7a7cec6f..b6537211b9cc 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1029,6 +1029,40 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
1029} 1029}
1030EXPORT_SYMBOL(do_mmap_pgoff); 1030EXPORT_SYMBOL(do_mmap_pgoff);
1031 1031
1032/*
1033 * Some shared mappigns will want the pages marked read-only
1034 * to track write events. If so, we'll downgrade vm_page_prot
1035 * to the private version (using protection_map[] without the
1036 * VM_SHARED bit).
1037 */
1038int vma_wants_writenotify(struct vm_area_struct *vma)
1039{
1040 unsigned int vm_flags = vma->vm_flags;
1041
1042 /* If it was private or non-writable, the write bit is already clear */
1043 if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
1044 return 0;
1045
1046 /* The backer wishes to know when pages are first written to? */
1047 if (vma->vm_ops && vma->vm_ops->page_mkwrite)
1048 return 1;
1049
1050 /* The open routine did something to the protections already? */
1051 if (pgprot_val(vma->vm_page_prot) !=
1052 pgprot_val(protection_map[vm_flags &
1053 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
1054 return 0;
1055
1056 /* Specialty mapping? */
1057 if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
1058 return 0;
1059
1060 /* Can the mapping track the dirty pages? */
1061 return vma->vm_file && vma->vm_file->f_mapping &&
1062 mapping_cap_account_dirty(vma->vm_file->f_mapping);
1063}
1064
1065
1032unsigned long mmap_region(struct file *file, unsigned long addr, 1066unsigned long mmap_region(struct file *file, unsigned long addr,
1033 unsigned long len, unsigned long flags, 1067 unsigned long len, unsigned long flags,
1034 unsigned int vm_flags, unsigned long pgoff, 1068 unsigned int vm_flags, unsigned long pgoff,
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index a7001410ab15..10367654ae77 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -17,6 +17,7 @@
17 17
18#include <linux/oom.h> 18#include <linux/oom.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/err.h>
20#include <linux/sched.h> 21#include <linux/sched.h>
21#include <linux/swap.h> 22#include <linux/swap.h>
22#include <linux/timex.h> 23#include <linux/timex.h>
diff --git a/mm/vmstat.c b/mm/vmstat.c
index fadf791cd7e6..c64d169537bf 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/err.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/cpu.h> 15#include <linux/cpu.h>
15#include <linux/sched.h> 16#include <linux/sched.h>