[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210819030650.716478-3-tongtiangen@huawei.com>
Date: Thu, 19 Aug 2021 03:06:50 +0000
From: Tong Tiangen <tongtiangen@...wei.com>
To: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Palmer Dabbelt <palmerdabbelt@...gle.com>,
Albert Ou <aou@...s.berkeley.edu>
CC: <linux-riscv@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
"Tong Tiangen" <tongtiangen@...wei.com>
Subject: [PATCH -next 2/2] 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@...wei.com>
---
arch/riscv/kernel/vdso.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c
index 5fecd5529eff..54629c11c639 100644
--- a/arch/riscv/kernel/vdso.c
+++ b/arch/riscv/kernel/vdso.c
@@ -73,7 +73,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;
--
2.18.0.huawei.25
Powered by blists - more mailing lists