Skip to content

Commit 2c152d9

Browse files
tongtiangengregkh
authored andcommitted
riscv/vdso: make arch_setup_additional_pages wait for mmap_sem for write killable
[ Upstream commit 8bb0ab3 ] riscv architectures relying on mmap_sem for write in their arch_setup_additional_pages. If the waiting task gets killed by the oom killer it would block oom_reaper from asynchronous address space reclaim and reduce the chances of timely OOM resolving. Wait for the lock in the killable mode and return with EINTR if the task got killed while waiting. Signed-off-by: Tong Tiangen <tongtiangen@huawei.com> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com> Fixes: 76d2a04 ("RISC-V: Init and Halt Code") Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent de834e1 commit 2c152d9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎arch/riscv/kernel/vdso.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
6565

6666
vdso_len = (vdso_pages + 1) << PAGE_SHIFT;
6767

68-
mmap_write_lock(mm);
68+
if (mmap_write_lock_killable(mm))
69+
return -EINTR;
70+
6971
vdso_base = get_unmapped_area(NULL, 0, vdso_len, 0, 0);
7072
if (IS_ERR_VALUE(vdso_base)) {
7173
ret = vdso_base;

0 commit comments

Comments
 (0)