+ oom_reaper-avoid-pointless-atomic_inc_not_zero-usage.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: oom_reaper: avoid pointless atomic_inc_not_zero usage.
has been added to the -mm tree.  Its filename is
     oom_reaper-avoid-pointless-atomic_inc_not_zero-usage.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/oom_reaper-avoid-pointless-atomic_inc_not_zero-usage.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/oom_reaper-avoid-pointless-atomic_inc_not_zero-usage.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Subject: oom_reaper: avoid pointless atomic_inc_not_zero usage.

Since commit 36324a990cf578b5 ("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@xxxxxxxxxxxxxxxxxxx
Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Acked-by: Michal Hocko <mhocko@xxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/oom_kill.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff -puN mm/oom_kill.c~oom_reaper-avoid-pointless-atomic_inc_not_zero-usage mm/oom_kill.c
--- a/mm/oom_kill.c~oom_reaper-avoid-pointless-atomic_inc_not_zero-usage
+++ a/mm/oom_kill.c
@@ -474,14 +474,8 @@ static bool __oom_reap_task(struct task_
 	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)) {
_

Patches currently in -mm which might be from penguin-kernel@xxxxxxxxxxxxxxxxxxx are

mmoom_reaper-dont-call-mmput_async-without-atomic_inc_not_zero.patch
oom_reaper-avoid-pointless-atomic_inc_not_zero-usage.patch
mmoom-remove-unused-argument-from-oom_scan_process_thread.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux