Skip to content

Commit 9df10fb

Browse files
Tetsuo Handatorvalds
authored andcommitted
oom_reaper: avoid pointless atomic_inc_not_zero usage.
Since commit 36324a9 ("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: http://lkml.kernel.org/r/1465024759-8074-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp Signed-off-by: Tetsuo Handa <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 491a1c6 commit 9df10fb

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

mm/oom_kill.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,8 @@ static bool __oom_reap_task(struct task_struct *tsk)
474474
p = find_lock_task_mm(tsk);
475475
if (!p)
476476
goto unlock_oom;
477-
478477
mm = p->mm;
479-
if (!atomic_inc_not_zero(&mm->mm_users)) {
480-
task_unlock(p);
481-
mm = NULL;
482-
goto unlock_oom;
483-
}
484-
478+
atomic_inc(&mm->mm_users);
485479
task_unlock(p);
486480

487481
if (!down_read_trylock(&mm->mmap_sem)) {

0 commit comments

Comments
 (0)