summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.com>2016-05-23 16:25:42 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-23 17:04:14 -0700
commit2d6c928241add2848e4eebfce407e95164229976 (patch)
tree61c481b880208893ab3a5386aca9608151174472 /mm
parentecc2bc8ac03884266cf73f8a2a42b911465b2fbc (diff)
mm: make vm_brk killable
Now that all the callers handle vm_brk failure we can change it wait for mmap_sem killable to help oom_reaper to not get blocked just because vm_brk gets blocked behind mmap_sem readers. Signed-off-by: Michal Hocko <mhocko@suse.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/mmap.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index ca292a7c2b68..d3d9a94ca031 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2712,12 +2712,9 @@ unsigned long vm_brk(unsigned long addr, unsigned long len)
unsigned long ret;
bool populate;
- /*
- * XXX not all users are chcecking the return value, convert
- * to down_write_killable after they are able to cope with
- * error
- */
- down_write(&mm->mmap_sem);
+ if (down_write_killable(&mm->mmap_sem))
+ return -EINTR;
+
ret = do_brk(addr, len);
populate = ((mm->def_flags & VM_LOCKED) != 0);
up_write(&mm->mmap_sem);