|
@@ -552,8 +552,9 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
|
|
victim = p;
|
|
victim = p;
|
|
}
|
|
}
|
|
|
|
|
|
- /* mm cannot safely be dereferenced after task_unlock(victim) */
|
|
|
|
|
|
+ /* Get a reference to safely compare mm after task_unlock(victim) */
|
|
mm = victim->mm;
|
|
mm = victim->mm;
|
|
|
|
+ atomic_inc(&mm->mm_count);
|
|
/*
|
|
/*
|
|
* We should send SIGKILL before setting TIF_MEMDIE in order to prevent
|
|
* We should send SIGKILL before setting TIF_MEMDIE in order to prevent
|
|
* the OOM victim from depleting the memory reserves from the user
|
|
* the OOM victim from depleting the memory reserves from the user
|
|
@@ -591,6 +592,7 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
|
|
}
|
|
}
|
|
rcu_read_unlock();
|
|
rcu_read_unlock();
|
|
|
|
|
|
|
|
+ mmdrop(mm);
|
|
put_task_struct(victim);
|
|
put_task_struct(victim);
|
|
}
|
|
}
|
|
#undef K
|
|
#undef K
|