Re: [patch 2/2] mm: remove task assumptions from swap token

Minchan Kim
2009-06-17T02:00:58Z

Hi, Hannes.

How about adding Hugh's comment ?

I think that is more straightforward and easy.
And it explained even real example like KSM.

So I suggest following as..

==
grab_swap_token() should not make any assumptions about the running
process as the swap token is an attribute of the address space and the
faulting mm is not necessarily current->mm.

If a kthread happens to use get_user_pages() on an mm (as KSM does),
there's a chance that it will end up trying to read in a swap page,
then oops in grab_swap_token() because the kthread has no mm: GUP
passes down the right mm, so grab_swap_token() ought to be using it.
==

Anyway, It looks good to me.
It might be just nitpick :)
If you feel it, ignore me.
Anyway I am OK.

On Tue, 16 Jun 2009 23:50:37 +0200
Johannes Weiner <hannes@cmpxchg.org> wrote:

> From: Hugh Dickins <hugh.dickins@tiscali.co.uk>
>
> grab_swap_token() should not make any assumptions about the running
> process as the swap token is an attribute of the address space and the
> faulting mm is not necessarily current->mm.
>
> This fixes get_user_pages() from kernel threads which would blow up
> when encountering a swapped out page and grab_swap_token()
> dereferencing the unset for kernel threads current->mm.
>
> Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Reviewed-by: Minchan Kim <minchan.kim@gmail.com>

--
Kinds Regards
Minchan Kim