Re: [PATCH] mm : Avoid candidate task is equal to current task

From: Oleg Nesterov
Date: Wed Apr 16 2014 - 09:58:28 EST


On 04/16, Peter Chiang wrote:
>
> mm_update_next_owner() call from exit_mm() , and exit_mm() change tsk->mm
> to NULL If p==c , It seems to be impossible that mm == c->mm (tsk->mm) .
> Because mm is non-NULL and c->mm is NULL .

Confused, please see below.

> Fix kernel panic when finding a new owner for the mm and the new owner is
> equal to current onwer

Did you actually observe the panic ?

> diff --git a/kernel/exit.c b/kernel/exit.c index 6ed6a1d..aa98422 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -399,7 +399,7 @@ retry:
> * here often
> */
> do_each_thread(g, c) {
> - if (c->mm == mm)
> + if ((c != p) && (c->mm == mm))
> goto assign_new_owner;
> } while_each_thread(g, c);

p == current. This is always called with p->mm == NULL and mm != NULL.

So, if c->mm == mm then at least c->mm != NULL, and this means that
c == p is not possible?

And it seems that this is exactly what you meant above. So why do you
think we need this change?

Oleg.

--
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/