On Sun, 6 Jun 2010 15:34:15 -0700 (PDT) David Rientjes <rientjes@xxxxxxxxxx> wrote: > From: Oleg Nesterov <oleg@xxxxxxxxxx> > > 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@xxxxxxxxxx> > Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> > --- > mm/oom_kill.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -300,7 +300,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints, > * the process of exiting and releasing its resources. > * Otherwise we could get an easy OOM deadlock. > */ > - if (p->flags & PF_EXITING) { > + if ((p->flags & PF_EXITING) && p->mm) { > if (p != current) > return ERR_PTR(-1UL); Looks good to me. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>