Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates.

From: Tetsuo Handa
Date: Thu Jan 07 2016 - 08:31:45 EST


Michal Hocko wrote:
> I do not think the placement in find_lock_task_mm is desirable nor
> correct. This function is used in multiple contexts outside of the oom
> proper. It only returns a locked task_struct for a thread that belongs
> to the process.

OK. Andrew, please drop from -mm tree for now.

> What you are seeing is clearly undesirable of course but I believe we
> should handle it at oom_kill_process layer. Blindly selecting a child
> process even when it doesn't sit on some memory or when it has already
> been killed is wrong. The heuristic is clearly too naive and so we
> should touch it rather than compensating it somewhere else. What about
> the following simple approach? It does two things and I will split it
> up if this looks like a desirable approach. Please note I haven't tested
> it because it is more of an idea than a finished thing. What do you think?

I think we need to filter at select_bad_process() and oom_kill_process().

When P has no children, P is chosen and TIF_MEMDIE is set on P. But P can
be chosen forever due to P->signal->oom_score_adj == OOM_SCORE_ADJ_MAX
even if the OOM reaper reclaimed P's mm. We need to ensure that
oom_kill_process() is not called with P if P already has TIF_MEMDIE.

(By the way, we are already assuming the OOM reaper kernel thread is
available. Changing to BUG_ON(IS_ERR(oom_reaper_th)) should be OK. ;-) )
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/