[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160128223351.GA14803@dhcp22.suse.cz>
Date: Thu, 28 Jan 2016 23:33:51 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Johannes Weiner <hannes@...xchg.org>, Mel Gorman <mgorman@...e.de>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
David Rientjes <rientjes@...gle.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Andrea Argangeli <andrea@...nel.org>,
Rik van Riel <riel@...hat.com>, linux-mm@...ck.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/2] oom: clear TIF_MEMDIE after oom_reaper managed to
unmap the address space
I have missed one important point. exit_oom_victim has to do
test_and_clear to make sure we do not race now with this patch. So we
need to fold the following into the patch
---
>From 296166b049ceb8b3199019a24aebab032998ebb0 Mon Sep 17 00:00:00 2001
From: Michal Hocko <mhocko@...e.com>
Date: Thu, 28 Jan 2016 23:27:26 +0100
Subject: [PATCH]
oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
Now that exit_oom_victim might be called on a remote task from
__oom_reap_task we have to check and clear the flag atomically
otherwise we might race and underflow oom_victims or wake up
waiters too early.
Signed-off-by: Michal Hocko <mhocko@...e.com>
---
mm/oom_kill.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 7209e517adf2..8f5488345c42 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -603,7 +603,8 @@ void mark_oom_victim(struct task_struct *tsk)
*/
void exit_oom_victim(struct task_struct *tsk)
{
- clear_tsk_thread_flag(tsk, TIF_MEMDIE);
+ if (!test_and_clear_tsk_thread_flag(tsk, TIF_MEMDIE))
+ return;
if (!atomic_dec_return(&oom_victims))
wake_up_all(&oom_victims_wait);
--
2.7.0.rc3
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists