mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
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>
This commit is contained in:
parent
ecc2bc8ac0
commit
2d6c928241
@ -2011,7 +2011,7 @@ static inline void mm_populate(unsigned long addr, unsigned long len) {}
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These take the mm semaphore themselves */
|
/* These take the mm semaphore themselves */
|
||||||
extern unsigned long vm_brk(unsigned long, unsigned long);
|
extern unsigned long __must_check vm_brk(unsigned long, unsigned long);
|
||||||
extern int vm_munmap(unsigned long, size_t);
|
extern int vm_munmap(unsigned long, size_t);
|
||||||
extern unsigned long __must_check vm_mmap(struct file *, unsigned long,
|
extern unsigned long __must_check vm_mmap(struct file *, unsigned long,
|
||||||
unsigned long, unsigned long,
|
unsigned long, unsigned long,
|
||||||
|
@ -2712,12 +2712,9 @@ unsigned long vm_brk(unsigned long addr, unsigned long len)
|
|||||||
unsigned long ret;
|
unsigned long ret;
|
||||||
bool populate;
|
bool populate;
|
||||||
|
|
||||||
/*
|
if (down_write_killable(&mm->mmap_sem))
|
||||||
* XXX not all users are chcecking the return value, convert
|
return -EINTR;
|
||||||
* to down_write_killable after they are able to cope with
|
|
||||||
* error
|
|
||||||
*/
|
|
||||||
down_write(&mm->mmap_sem);
|
|
||||||
ret = do_brk(addr, len);
|
ret = do_brk(addr, len);
|
||||||
populate = ((mm->def_flags & VM_LOCKED) != 0);
|
populate = ((mm->def_flags & VM_LOCKED) != 0);
|
||||||
up_write(&mm->mmap_sem);
|
up_write(&mm->mmap_sem);
|
||||||
|
Loading…
Reference in New Issue
Block a user