|
@@ -554,6 +554,12 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
|
|
|
|
|
|
/* mm cannot safely be dereferenced after task_unlock(victim) */
|
|
|
mm = victim->mm;
|
|
|
+ /*
|
|
|
+ * We should send SIGKILL before setting TIF_MEMDIE in order to prevent
|
|
|
+ * the OOM victim from depleting the memory reserves from the user
|
|
|
+ * space under its control.
|
|
|
+ */
|
|
|
+ do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true);
|
|
|
mark_oom_victim(victim);
|
|
|
pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB\n",
|
|
|
task_pid_nr(victim), victim->comm, K(victim->mm->total_vm),
|
|
@@ -585,7 +591,6 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
|
|
|
}
|
|
|
rcu_read_unlock();
|
|
|
|
|
|
- do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true);
|
|
|
put_task_struct(victim);
|
|
|
}
|
|
|
#undef K
|