riscv/vdso: make arch_setup_additional_pages wait for mmap_sem for write killable

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: 76d2a0493a ("RISC-V: Init and Halt Code")
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
Tong Tiangen 2021-09-01 02:46:21 +00:00 коммит произвёл Palmer Dabbelt
Родитель 78a743cd82
Коммит 8bb0ab3ae7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 2E1319F35FBB1889
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -77,7 +77,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
vdso_len = (vdso_pages + VVAR_NR_PAGES) << PAGE_SHIFT;
mmap_write_lock(mm);
if (mmap_write_lock_killable(mm))
return -EINTR;
vdso_base = get_unmapped_area(NULL, 0, vdso_len, 0, 0);
if (IS_ERR_VALUE(vdso_base)) {
ret = vdso_base;