staging: android: lowmemorykiller: set TIF_MEMDIE before send kill sig
authorWeijie Yang <weijie.yang@samsung.com>
Fri, 14 Feb 2014 06:03:56 +0000 (14:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2014 17:18:39 +0000 (09:18 -0800)
Set TIF_MEMDIE tsk_thread flag before send kill signal to the
selected thread. This is to fit a usual code sequence and avoid
potential race issue.

Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/lowmemorykiller.c

index 6f094b37f1f1dc0388d07246635eadbe9c7399ff..4bcf00a872705927d8228ac33af82d06d19e6ec0 100644 (file)
@@ -159,8 +159,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
                             selected->pid, selected->comm,
                             selected_oom_score_adj, selected_tasksize);
                lowmem_deathpending_timeout = jiffies + HZ;
-               send_sig(SIGKILL, selected, 0);
                set_tsk_thread_flag(selected, TIF_MEMDIE);
+               send_sig(SIGKILL, selected, 0);
                rem += selected_tasksize;
        }