]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/oom_kill.c
dm rq: check blk_mq_register_dev() return value in dm_mq_init_request_queue()
[karo-tx-linux.git] / mm / oom_kill.c
index 578321f1c070ae6c96396ea5ba40276544264254..d083714a2bb924a0303fa7535acf09d7355aedf0 100644 (file)
@@ -22,6 +22,9 @@
 #include <linux/err.h>
 #include <linux/gfp.h>
 #include <linux/sched.h>
+#include <linux/sched/mm.h>
+#include <linux/sched/coredump.h>
+#include <linux/sched/task.h>
 #include <linux/swap.h>
 #include <linux/timex.h>
 #include <linux/jiffies.h>
@@ -653,7 +656,7 @@ static void mark_oom_victim(struct task_struct *tsk)
 
        /* oom_mm is bound to the signal struct life time. */
        if (!cmpxchg(&tsk->signal->oom_mm, NULL, mm))
-               atomic_inc(&tsk->signal->oom_mm->mm_count);
+               mmgrab(tsk->signal->oom_mm);
 
        /*
         * Make sure that the task is woken up from uninterruptible sleep
@@ -870,7 +873,7 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
 
        /* Get a reference to safely compare mm after task_unlock(victim) */
        mm = victim->mm;
-       atomic_inc(&mm->mm_count);
+       mmgrab(mm);
        /*
         * We should send SIGKILL before setting TIF_MEMDIE in order to prevent
         * the OOM victim from depleting the memory reserves from the user