diff options
author | Michal Hocko <mhocko@suse.com> | 2016-05-23 19:25:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-23 20:04:14 -0400 |
commit | 2d6c928241add2848e4eebfce407e95164229976 (patch) | |
tree | 61c481b880208893ab3a5386aca9608151174472 | |
parent | ecc2bc8ac03884266cf73f8a2a42b911465b2fbc (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>
-rw-r--r-- | include/linux/mm.h | 2 | ||||
-rw-r--r-- | mm/mmap.c | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index d5eb8dddd7c0..2835d598d258 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -2011,7 +2011,7 @@ static inline void mm_populate(unsigned long addr, unsigned long len) {} | |||
2011 | #endif | 2011 | #endif |
2012 | 2012 | ||
2013 | /* These take the mm semaphore themselves */ | 2013 | /* These take the mm semaphore themselves */ |
2014 | extern unsigned long vm_brk(unsigned long, unsigned long); | 2014 | extern unsigned long __must_check vm_brk(unsigned long, unsigned long); |
2015 | extern int vm_munmap(unsigned long, size_t); | 2015 | extern int vm_munmap(unsigned long, size_t); |
2016 | extern unsigned long __must_check vm_mmap(struct file *, unsigned long, | 2016 | extern unsigned long __must_check vm_mmap(struct file *, unsigned long, |
2017 | unsigned long, unsigned long, | 2017 | unsigned long, unsigned long, |
@@ -2712,12 +2712,9 @@ unsigned long vm_brk(unsigned long addr, unsigned long len) | |||
2712 | unsigned long ret; | 2712 | unsigned long ret; |
2713 | bool populate; | 2713 | bool populate; |
2714 | 2714 | ||
2715 | /* | 2715 | if (down_write_killable(&mm->mmap_sem)) |
2716 | * XXX not all users are chcecking the return value, convert | 2716 | return -EINTR; |
2717 | * to down_write_killable after they are able to cope with | 2717 | |
2718 | * error | ||
2719 | */ | ||
2720 | down_write(&mm->mmap_sem); | ||
2721 | ret = do_brk(addr, len); | 2718 | ret = do_brk(addr, len); |
2722 | populate = ((mm->def_flags & VM_LOCKED) != 0); | 2719 | populate = ((mm->def_flags & VM_LOCKED) != 0); |
2723 | up_write(&mm->mmap_sem); | 2720 | up_write(&mm->mmap_sem); |