+ mm-oom-remove-oom_lock-from-exit_mmap.patch added to -mm tree

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

 



The patch titled
     Subject: mm, oom: remove oom_lock from exit_mmap()
has been added to the -mm tree.  Its filename is
     mm-oom-remove-oom_lock-from-exit_mmap.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-oom-remove-oom_lock-from-exit_mmap.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-oom-remove-oom_lock-from-exit_mmap.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/process/submit-checklist.rst when testing your code ***

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

------------------------------------------------------
From: David Rientjes <rientjes@xxxxxxxxxx>
Subject: mm, oom: remove oom_lock from exit_mmap()

oom_lock isn't needed for __oom_reap_task_mm().  If MMF_UNSTABLE is
already set for the mm, we can simply back out immediately since oom
reaping is already in progress (or done).

Link: http://lkml.kernel.org/r/alpine.DEB.2.21.1807121432370.170100@xxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxxxx>
Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---


diff -puN mm/mmap.c~mm-oom-remove-oom_lock-from-exit_mmap mm/mmap.c
--- a/mm/mmap.c~mm-oom-remove-oom_lock-from-exit_mmap
+++ a/mm/mmap.c
@@ -3081,9 +3081,7 @@ void exit_mmap(struct mm_struct *mm)
 		 * to mmu_notifier_release(mm) ensures mmu notifier callbacks in
 		 * __oom_reap_task_mm() will not block.
 		 */
-		mutex_lock(&oom_lock);
 		__oom_reap_task_mm(mm);
-		mutex_unlock(&oom_lock);
 
 		/*
 		 * Now, set MMF_UNSTABLE to avoid racing with the oom reaper.
diff -puN mm/oom_kill.c~mm-oom-remove-oom_lock-from-exit_mmap mm/oom_kill.c
--- a/mm/oom_kill.c~mm-oom-remove-oom_lock-from-exit_mmap
+++ a/mm/oom_kill.c
@@ -496,9 +496,11 @@ void __oom_reap_task_mm(struct mm_struct
 	 * Tell all users of get_user/copy_from_user etc... that the content
 	 * is no longer stable. No barriers really needed because unmapping
 	 * should imply barriers already and the reader would hit a page fault
-	 * if it stumbled over a reaped memory.
+	 * if it stumbled over a reaped memory. If MMF_UNSTABLE is already set,
+	 * reaping as already occurred so nothing left to do.
 	 */
-	set_bit(MMF_UNSTABLE, &mm->flags);
+	if (test_and_set_bit(MMF_UNSTABLE, &mm->flags))
+		return;
 
 	for (vma = mm->mmap ; vma; vma = vma->vm_next) {
 		if (!can_madv_dontneed_vma(vma))
_

Patches currently in -mm which might be from rientjes@xxxxxxxxxx are

mm-oom-fix-unnecessary-killing-of-additional-processes.patch
mm-oom-remove-oom_lock-from-exit_mmap.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 Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux