On 2019/07/01 22:17, Michal Hocko wrote: > On Mon 01-07-19 22:04:22, Tetsuo Handa wrote: >> But I realized that this patch was too optimistic. We need to wait for mm-less >> threads until MMF_OOM_SKIP is set if the process was already an OOM victim. > > If the process is an oom victim then _all_ threads are so as well > because that is the address space property. And we already do check that > before reaching oom_badness IIRC. So what is the actual problem you are > trying to solve here? I'm talking about behavioral change after tsk became an OOM victim. If tsk->signal->oom_mm != NULL, we have to wait for MMF_OOM_SKIP even if tsk->mm == NULL. Otherwise, the OOM killer selects next OOM victim as soon as oom_unkillable_task() returned true because has_intersects_mems_allowed() returned false because mempolicy_nodemask_intersects() returned false because all thread's mm became NULL (despite tsk->signal->oom_mm != NULL). static int oom_evaluate_task(struct task_struct *task, void *arg) { if (oom_unkillable_task(task, NULL, oc->nodemask)) goto next; if (!is_sysrq_oom(oc) && tsk_is_oom_victim(task)) { if (test_bit(MMF_OOM_SKIP, &task->signal->oom_mm->flags)) goto next; goto abort; } }