[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <156007493638.3335.4872164955523928492.stgit@buzz>
Date: Sun, 09 Jun 2019 13:08:56 +0300
From: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
To: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Cc: Oleg Nesterov <oleg@...hat.com>,
Matthew Wilcox <willy@...radead.org>,
Michal Hocko <mhocko@...nel.org>,
Cyrill Gorcunov <gorcunov@...il.com>,
Kirill Tkhai <ktkhai@...tuozzo.com>,
Michal Koutný <mkoutny@...e.com>,
Al Viro <viro@...iv.linux.org.uk>, Roman Gushchin <guro@...com>
Subject: [PATCH v2 3/6] proc: use down_read_killable mmap_sem for
/proc/pid/pagemap
Do not stuck forever if something wrong.
Killable lock allows to cleanup stuck tasks and simplifies investigation.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Reviewed-by: Roman Gushchin <guro@...com>
Reviewed-by: Cyrill Gorcunov <gorcunov@...il.com>
Reviewed-by: Kirill Tkhai <ktkhai@...tuozzo.com>
Acked-by: Michal Hocko <mhocko@...e.com>
---
fs/proc/task_mmu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 781879a91e3b..78bed6adc62d 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1547,7 +1547,9 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
/* overflow ? */
if (end < start_vaddr || end > end_vaddr)
end = end_vaddr;
- down_read(&mm->mmap_sem);
+ ret = down_read_killable(&mm->mmap_sem);
+ if (ret)
+ goto out_free;
ret = walk_page_range(start_vaddr, end, &pagemap_walk);
up_read(&mm->mmap_sem);
start_vaddr = end;
Powered by blists - more mailing lists