staging: android/lowmemorykiller: Better mm handling
authorAnton Vorontsov <anton.vorontsov@linaro.org>
Mon, 6 Feb 2012 16:29:47 +0000 (20:29 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2012 00:55:45 +0000 (16:55 -0800)
commit95670001188911f9d466875cd68e3681f39df38a
tree9610b1dc93b48119d69a422348bc867f2139757f
parent294b27119f2e20643e71a0c1a1b511320a11e4c3
staging: android/lowmemorykiller: Better mm handling

LMK should not directly check for task->mm. The reason is that the
process' threads may exit or detach its mm via use_mm(), but other
threads may still have a valid mm. To catch this we use
find_lock_task_mm(), which walks up all threads and returns an
appropriate task (with lock held).

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/lowmemorykiller.c