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

From: Peter Chiang
Date: Thu Apr 17 2014 - 02:48:45 EST


You are right !! It is not a right solution .

It is a speculation where the panic was.

[38261.652100] Call trace:
[38261.654616] [<ffffffc000aa6fe0>] mm_update_next_owner+0x190/0x238
[38261.660766] [<ffffffc000aa728c>] do_exit+0x204/0x924
[38261.665790] [<ffffffc000aa7a1c>] do_group_exit+0x40/0xcc
[38261.671169] [<ffffffc000ab59cc>] get_signal_to_deliver+0x218/0x57c
[38261.677409] [<ffffffc000a87e6c>] do_signal+0x534/0x550
[38261.682608] [<ffffffc000a88070>] do_notify_resume+0x20/0x58

-----Original Message-----
From: Oleg Nesterov [mailto:oleg@xxxxxxxxxx]
Sent: Wednesday, April 16, 2014 9:58 PM
To: Peter Chiang
Cc: ccross@xxxxxxxxxxx; lizefan@xxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; tj@xxxxxxxxxx; pavel@xxxxxx; ebiederm@xxxxxxxxxxxx; guillaume@xxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] mm : Avoid candidate task is equal to current task

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/