Commit 9df10fb7 authored by Tetsuo Handa's avatar Tetsuo Handa Committed by Linus Torvalds

oom_reaper: avoid pointless atomic_inc_not_zero usage.

Since commit 36324a99 ("oom: clear TIF_MEMDIE after oom_reaper
managed to unmap the address space") changed to use find_lock_task_mm()
for finding a mm_struct to reap, it is guaranteed that mm->mm_users > 0
because find_lock_task_mm() returns a task_struct with ->mm != NULL.
Therefore, we can safely use atomic_inc().

Link: default avatarTetsuo Handa <>
Acked-by: default avatarMichal Hocko <>
Cc: Arnd Bergmann <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 491a1c65
......@@ -474,14 +474,8 @@ static bool __oom_reap_task(struct task_struct *tsk)
p = find_lock_task_mm(tsk);
if (!p)
goto unlock_oom;
mm = p->mm;
if (!atomic_inc_not_zero(&mm->mm_users)) {
mm = NULL;
goto unlock_oom;
if (!down_read_trylock(&mm->mmap_sem)) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment