mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + mm-mlock-use-vma-iterator-and-instead-of-vma-linked-list-fix.patch added to -mm tree
@ 2022-04-27 17:48 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-04-27 17:48 UTC (permalink / raw)
  To: mm-commits, sfr, quic_qiancai, Liam.Howlett, liam.howlett, akpm


The patch titled
     Subject: mm/mlock: use maple state in apply_mlockall_flags()
has been added to the -mm tree.  Its filename is
     mm-mlock-use-vma-iterator-and-instead-of-vma-linked-list-fix.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-mlock-use-vma-iterator-and-instead-of-vma-linked-list-fix.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-mlock-use-vma-iterator-and-instead-of-vma-linked-list-fix.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: Liam Howlett <liam.howlett@oracle.com>
Subject: mm/mlock: use maple state in apply_mlockall_flags()

The vma iterator is for simple cases.  Since mlock_fixup() can cause the
tree to change and thus requires the maple state to be reset,
apply_mlockall_flags() is not a simple case.  Use a maple state and call
mas_pause() instead.

Link: https://lkml.kernel.org/r/20220427165139.5s3qcj2u5vqrvwlc@revolver
Fixes: 0d43186b36c1 (mm/mlock: use vma iterator and instead of vma linked list)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reported-by: Qian Cai <quic_qiancai@quicinc.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/mlock.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/mm/mlock.c~mm-mlock-use-vma-iterator-and-instead-of-vma-linked-list-fix
+++ a/mm/mlock.c
@@ -660,7 +660,7 @@ SYSCALL_DEFINE2(munlock, unsigned long,
  */
 static int apply_mlockall_flags(int flags)
 {
-	VMA_ITERATOR(vmi, current->mm, 0);
+	MA_STATE(mas, &current->mm->mm_mt, 0, 0);
 	struct vm_area_struct *vma, *prev = NULL;
 	vm_flags_t to_add = 0;
 
@@ -681,7 +681,7 @@ static int apply_mlockall_flags(int flag
 			to_add |= VM_LOCKONFAULT;
 	}
 
-	for_each_vma(vmi, vma) {
+	mas_for_each(&mas, vma, ULONG_MAX) {
 		vm_flags_t newflags;
 
 		newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK;
@@ -689,6 +689,7 @@ static int apply_mlockall_flags(int flag
 
 		/* Ignore errors */
 		mlock_fixup(vma, &prev, vma->vm_start, vma->vm_end, newflags);
+		mas_pause(&mas);
 		cond_resched();
 	}
 out:
_

Patches currently in -mm which might be from liam.howlett@oracle.com are

maple-tree-add-new-data-structure-fix.patch
userfaultfd-use-maple-tree-iterator-to-iterate-vmas-fix.patch
mm-mlock-use-vma-iterator-and-instead-of-vma-linked-list-fix.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-27 17:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 17:48 + mm-mlock-use-vma-iterator-and-instead-of-vma-linked-list-fix.patch added to -mm tree Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).