Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1345806 > unrolled thread

[PATCH 11/18] coredump: make coredump_wait wait for mma_sem for write killable

Started byMichal Hocko <mhocko@kernel.org>
First post2016-02-29 14:30 +0100
Last post2016-02-29 17:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 11/18] coredump: make coredump_wait wait for mma_sem for write killable Michal Hocko <mhocko@kernel.org> - 2016-02-29 14:30 +0100
    Re: [PATCH 11/18] coredump: make coredump_wait wait for mma_sem for  write killable Oleg Nesterov <oleg@redhat.com> - 2016-02-29 17:00 +0100

#1345806 — [PATCH 11/18] coredump: make coredump_wait wait for mma_sem for write killable

FromMichal Hocko <mhocko@kernel.org>
Date2016-02-29 14:30 +0100
Subject[PATCH 11/18] coredump: make coredump_wait wait for mma_sem for write killable
Message-ID<r7w3D-3yu-5@gated-at.bofh.it>
From: Michal Hocko <mhocko@suse.com>

coredump_wait waits for mmap_sem for write currently which can
prevent oom_reaper to reclaim the oom victims address space
asynchronously because that requires mmap_sem for read. This might
happen if the oom victim is multi threaded and some thread(s) is
holding mmap_sem for read (e.g. page fault) and it is stuck in
the page allocator while other thread(s) reached coredump_wait
already.

This patch simply uses down_write_killable and bails out with EINTR
if the lock got interrupted by the fatal signal. do_coredump will
return right away and do_group_exit will take care to zap the whole
thread group.

Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
 fs/coredump.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 9ea87e9fdccf..6b8aa1629891 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -410,7 +410,9 @@ static int coredump_wait(int exit_code, struct core_state *core_state)
 	core_state->dumper.task = tsk;
 	core_state->dumper.next = NULL;
 
-	down_write(&mm->mmap_sem);
+	if (down_write_killable(&mm->mmap_sem))
+		return -EINTR;
+
 	if (!mm->core_state)
 		core_waiters = zap_threads(tsk, mm, core_state, exit_code);
 	up_write(&mm->mmap_sem);
-- 
2.7.0

[toc] | [next] | [standalone]


#1345932 — Re: [PATCH 11/18] coredump: make coredump_wait wait for mma_sem for write killable

FromOleg Nesterov <oleg@redhat.com>
Date2016-02-29 17:00 +0100
SubjectRe: [PATCH 11/18] coredump: make coredump_wait wait for mma_sem for write killable
Message-ID<r7yoO-4YQ-11@gated-at.bofh.it>
In reply to#1345806
On 02/29, Michal Hocko wrote:
>
> --- a/fs/coredump.c
> +++ b/fs/coredump.c
> @@ -410,7 +410,9 @@ static int coredump_wait(int exit_code, struct core_state *core_state)
>  	core_state->dumper.task = tsk;
>  	core_state->dumper.next = NULL;
>  
> -	down_write(&mm->mmap_sem);
> +	if (down_write_killable(&mm->mmap_sem))
> +		return -EINTR;
> +

ACK, thanks.

Oleg.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web