mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
oom_reaper: avoid pointless atomic_inc_not_zero usage.
Since commit 36324a990c ("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]>
This commit is contained in:
1 parent
491a1c65ae
commit
9df10fb7b8
1 file changed
+1
-7
+1
-7
@@ -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)) {
|
||||
task_unlock(p);
|
||||
mm = NULL;
|
||||
goto unlock_oom;
|
||||
}
|
||||
|
||||
atomic_inc(&mm->mm_users);
|
||||
task_unlock(p);
|
||||
|
||||
if (!down_read_trylock(&mm->mmap_sem)) {
|
||||
|
||||
Reference in new issue
Block a user