Re: [PATCH 1/3 for 2.6.38] oom: oom_kill_process: don't set TIF_MEMDIEif !p->mm

From: David Rientjes
Date: Mon Mar 14 2011 - 16:32:55 EST


On Mon, 14 Mar 2011, Linus Torvalds wrote:

> The combination of testing PF_EXITING and p->mm just doesn't seem to
> make any sense.
>

Right, it doesn't (and I recently removed testing the combination from
select_bad_process() in -mm). The check for PF_EXITING in the oom killer
is purely to avoid needlessly killing tasks when something is already
exiting and will (hopefully) be freeing its memory soon. If an eligible
thread is found to be PF_EXITING, the oom killer will defer indefinitely
unless it happens to be current. If it happens to be current, then it is
automatically selected so it gets access to the needed memory reserves.

We do need to ensure that behavior doesn't preempt any task from being
killed if there's an eligible thread other than current that never
actually detaches its ->mm (oom-skip-zombies-when-iterating-tasklist.patch
in -mm filters all threads without an ->mm). That can happen if
mm->mmap_sem never gets released by a thread and that's why an earlier
change that is already in your tree automatically gives current access to
memory reserves immediately upon calling the oom killer if it has a
pending SIGKILL.
--
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/