diff options
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -1265,12 +1265,7 @@ out: | |||
1265 | mm->total_vm += len >> PAGE_SHIFT; | 1265 | mm->total_vm += len >> PAGE_SHIFT; |
1266 | vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT); | 1266 | vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT); |
1267 | if (vm_flags & VM_LOCKED) { | 1267 | if (vm_flags & VM_LOCKED) { |
1268 | /* | ||
1269 | * makes pages present; downgrades, drops, reacquires mmap_sem | ||
1270 | */ | ||
1271 | long nr_pages = mlock_vma_pages_range(vma, addr, addr + len); | 1268 | long nr_pages = mlock_vma_pages_range(vma, addr, addr + len); |
1272 | if (nr_pages < 0) | ||
1273 | return nr_pages; /* vma gone! */ | ||
1274 | mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages; | 1269 | mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages; |
1275 | } else if ((flags & MAP_POPULATE) && !(flags & MAP_NONBLOCK)) | 1270 | } else if ((flags & MAP_POPULATE) && !(flags & MAP_NONBLOCK)) |
1276 | make_pages_present(addr, addr + len); | 1271 | make_pages_present(addr, addr + len); |
@@ -1754,8 +1749,7 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) | |||
1754 | if (!prev || expand_stack(prev, addr)) | 1749 | if (!prev || expand_stack(prev, addr)) |
1755 | return NULL; | 1750 | return NULL; |
1756 | if (prev->vm_flags & VM_LOCKED) { | 1751 | if (prev->vm_flags & VM_LOCKED) { |
1757 | if (mlock_vma_pages_range(prev, addr, prev->vm_end) < 0) | 1752 | mlock_vma_pages_range(prev, addr, prev->vm_end); |
1758 | return NULL; /* vma gone! */ | ||
1759 | } | 1753 | } |
1760 | return prev; | 1754 | return prev; |
1761 | } | 1755 | } |
@@ -1783,8 +1777,7 @@ find_extend_vma(struct mm_struct * mm, unsigned long addr) | |||
1783 | if (expand_stack(vma, addr)) | 1777 | if (expand_stack(vma, addr)) |
1784 | return NULL; | 1778 | return NULL; |
1785 | if (vma->vm_flags & VM_LOCKED) { | 1779 | if (vma->vm_flags & VM_LOCKED) { |
1786 | if (mlock_vma_pages_range(vma, addr, start) < 0) | 1780 | mlock_vma_pages_range(vma, addr, start); |
1787 | return NULL; /* vma gone! */ | ||
1788 | } | 1781 | } |
1789 | return vma; | 1782 | return vma; |
1790 | } | 1783 | } |