From: David Rientjes on
On Mon, 31 May 2010, KOSAKI Motohiro wrote:

> From: Oleg Nesterov <oleg(a)>
> Subject: oom: select_bad_process: PF_EXITING check should take ->mm into account
> select_bad_process() checks PF_EXITING to detect the task which is going
> to release its memory, but the logic is very wrong.
> - a single process P with the dead group leader disables
> select_bad_process() completely, it will always return
> ERR_PTR() while P can live forever
> - if the PF_EXITING task has already released its ->mm
> it doesn't make sense to expect it is goiing to free
> more memory (except task_struct/etc)
> Change the code to ignore the PF_EXITING tasks without ->mm.
> Signed-off-by: Oleg Nesterov <oleg(a)>
> Acked-by: David Rientjes <rientjes(a)>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro(a)> [rebase to latest -mm]

This is already pushed in my oom killer rewrite as patch 13/18 "oom: avoid
race for oom killed tasks detaching mm prior to exit".

It's not vital to merge now because causing the oom killer to temporarily
become a no-op before it can fully exit even though it has already
detached its memory only delays killing another task until it exits and
there's nothing in the way of that exiting while it's still under
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at