Re: [PATCH v2] mm, oom: don't set TIF_MEMDIE on a mm-less thread.
From: Michal Hocko <mhocko@kernel.org>
Date: 2016-06-24 09:54:42
On Fri 24-06-16 01:24:46, Tetsuo Handa wrote:
I missed that victim != p case needs to use get_task_struct(). Patch updated. ----------------------------------------quoted
From 1819ec63b27df2d544f66482439e754d084cebed Mon Sep 17 00:00:00 2001From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Date: Fri, 24 Jun 2016 01:16:02 +0900 Subject: [PATCH v2] mm, oom: don't set TIF_MEMDIE on a mm-less thread. Patch "mm, oom: fortify task_will_free_mem" removed p->mm != NULL test for shortcut path in oom_kill_process(). But since commit f44666b04605d1c7 ("mm,oom: speed up select_bad_process() loop") changed to iterate using thread group leaders, the possibility of p->mm == NULL has increased compared to when commit 83363b917a2982dd ("oom: make sure that TIF_MEMDIE is set under task_lock") was proposed. On CONFIG_MMU=n kernels, nothing will clear TIF_MEMDIE and the system can OOM livelock if TIF_MEMDIE was by error set to a mm-less thread group leader. Let's do steps for regular path except printing OOM killer messages and sending SIGKILL.
I fully agree with Oleg. It would be much better to encapsulate this into mark_oom_victim and guard it by ifdef NOMMU as this is nommu specific with a big fat warning why we need it. -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>