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

From: Minchan Kim
Date: Tue Jun 16 2009 - 22:01:06 EST


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@xxxxxxxxxxx> wrote:

> From: Hugh Dickins <hugh.dickins@xxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxx>
> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>

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

--
Kinds Regards
Minchan Kim
--
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/