[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1456752417-9626-12-git-send-email-mhocko@kernel.org>
Date: Mon, 29 Feb 2016 14:26:50 +0100
From: Michal Hocko <mhocko@...nel.org>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, <linux-mm@...ck.org>,
Alex Deucher <alexander.deucher@....com>,
Alex Thorlton <athorlton@....com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andy Lutomirski <luto@...capital.net>,
Benjamin LaHaise <bcrl@...ck.org>,
Christian König <christian.koenig@....com>,
Daniel Vetter <daniel.vetter@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
David Airlie <airlied@...ux.ie>,
Davidlohr Bueso <dave@...olabs.net>,
David Rientjes <rientjes@...gle.com>,
"H . Peter Anvin" <hpa@...or.com>, Hugh Dickins <hughd@...gle.com>,
Ingo Molnar <mingo@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Konstantin Khlebnikov <koct9i@...il.com>,
linux-arch@...r.kernel.org, Mel Gorman <mgorman@...e.de>,
Oleg Nesterov <oleg@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Petr Cermak <petrcermak@...omium.org>,
Thomas Gleixner <tglx@...utronix.de>,
Michal Hocko <mhocko@...e.com>
Subject: [PATCH 11/18] coredump: make coredump_wait wait for mma_sem for write killable
From: Michal Hocko <mhocko@...e.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@...hat.com>
Signed-off-by: Michal Hocko <mhocko@...e.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
Powered by blists - more mailing lists