Messages in this thread | | | Date | Tue, 6 Apr 2010 14:18:11 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH -mm 2/4] oom: select_bad_process: PF_EXITING check should take ->mm into account |
| |
On 04/06, anfei wrote: > > On Fri, Apr 02, 2010 at 08:32:16PM +0200, Oleg Nesterov wrote: > > 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@redhat.com> > > --- > > > > mm/oom_kill.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > --- MM/mm/oom_kill.c~2_FIX_PF_EXITING 2010-04-02 18:51:05.000000000 +0200 > > +++ MM/mm/oom_kill.c 2010-04-02 18:58:37.000000000 +0200 > > @@ -322,7 +322,7 @@ static struct task_struct *select_bad_pr > > * 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) { > > Even this check is satisfied, it still can't say p is a good victim or > it will release memory automatically if multi threaded, as the exiting > of p doesn't mean the other threads are going to exit, so the ->mm won't > be released.
Yes, completely agreed.
Unfortunately I forgot to copy this into the changelog, but when I discussed this change I mentioned "still not perfect, but much better".
I do not really know what is the "right" solution. Even if we fix this check for mt case, we also have CLONE_VM tasks.
So, this patch just tries to improve things, to avoid the easy-to-trigger false positives.
Oleg.
| |