aboutsummaryrefslogtreecommitdiffstats
path: root/mm/nommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/nommu.c')
-rw-r--r--mm/nommu.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index 23fb033e596d..1f60194d9b9b 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -45,6 +45,7 @@ int heap_stack_gap = 0;
45 45
46EXPORT_SYMBOL(mem_map); 46EXPORT_SYMBOL(mem_map);
47EXPORT_SYMBOL(__vm_enough_memory); 47EXPORT_SYMBOL(__vm_enough_memory);
48EXPORT_SYMBOL(num_physpages);
48 49
49/* list of shareable VMAs */ 50/* list of shareable VMAs */
50struct rb_root nommu_vma_tree = RB_ROOT; 51struct rb_root nommu_vma_tree = RB_ROOT;
@@ -826,6 +827,11 @@ unsigned long do_mmap_pgoff(struct file *file,
826 unsigned long pglen = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; 827 unsigned long pglen = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
827 unsigned long vmpglen; 828 unsigned long vmpglen;
828 829
830 /* suppress VMA sharing for shared regions */
831 if (vm_flags & VM_SHARED &&
832 capabilities & BDI_CAP_MAP_DIRECT)
833 goto dont_share_VMAs;
834
829 for (rb = rb_first(&nommu_vma_tree); rb; rb = rb_next(rb)) { 835 for (rb = rb_first(&nommu_vma_tree); rb; rb = rb_next(rb)) {
830 vma = rb_entry(rb, struct vm_area_struct, vm_rb); 836 vma = rb_entry(rb, struct vm_area_struct, vm_rb);
831 837
@@ -859,6 +865,7 @@ unsigned long do_mmap_pgoff(struct file *file,
859 goto shared; 865 goto shared;
860 } 866 }
861 867
868 dont_share_VMAs:
862 vma = NULL; 869 vma = NULL;
863 870
864 /* obtain the address at which to make a shared mapping 871 /* obtain the address at which to make a shared mapping
@@ -1193,6 +1200,28 @@ void unmap_mapping_range(struct address_space *mapping,
1193EXPORT_SYMBOL(unmap_mapping_range); 1200EXPORT_SYMBOL(unmap_mapping_range);
1194 1201
1195/* 1202/*
1203 * ask for an unmapped area at which to create a mapping on a file
1204 */
1205unsigned long get_unmapped_area(struct file *file, unsigned long addr,
1206 unsigned long len, unsigned long pgoff,
1207 unsigned long flags)
1208{
1209 unsigned long (*get_area)(struct file *, unsigned long, unsigned long,
1210 unsigned long, unsigned long);
1211
1212 get_area = current->mm->get_unmapped_area;
1213 if (file && file->f_op && file->f_op->get_unmapped_area)
1214 get_area = file->f_op->get_unmapped_area;
1215
1216 if (!get_area)
1217 return -ENOSYS;
1218
1219 return get_area(file, addr, len, pgoff, flags);
1220}
1221
1222EXPORT_SYMBOL(get_unmapped_area);
1223
1224/*
1196 * Check that a process has enough memory to allocate a new virtual 1225 * Check that a process has enough memory to allocate a new virtual
1197 * mapping. 0 means there is enough memory for the allocation to 1226 * mapping. 0 means there is enough memory for the allocation to
1198 * succeed and -ENOMEM implies there is not. 1227 * succeed and -ENOMEM implies there is not.