Michal Hocko wrote: > > Also, why not to call set_tsk_thread_flag() and do_send_sig_info() together > > like below > > What would be an advantage? I am not really sure whether the two locks > might nest as well. I imagined that current thread sets TIF_MEMDIE on a victim thread, then sleeps for 30 seconds immediately after task_unlock() (it's an overdone delay), and finally sets SIGKILL on that victim thread. If such a delay happened, that victim thread is free to abuse TIF_MEMDIE for that period. Thus, I thought sending SIGKILL followed by setting TIF_MEMDIE is better. rcu_read_unlock(); - set_tsk_thread_flag(victim, TIF_MEMDIE); do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true); + task_lock(victim); + if (victim->mm) + set_tsk_thread_flag(victim, TIF_MEMDIE); + task_unlock(victim); put_task_struct(victim); If such a delay is theoretically impossible, I'm OK with your patch. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>