linux-next: manual merge of the folio tree with the maple tree

From: Stephen Rothwell
Date: Thu Feb 17 2022 - 02:11:33 EST


Hi all,

Today's linux-next merge of the folio tree got a conflict in:

mm/mmap.c

between commit:

b09e8361a4c3 ("mm: Remove the vma linked list")

from the maple tree and commit:

ad56e23dec9a ("mm/munlock: delete munlock_vma_pages_all(), allow oomreap")

from the folio tree.

I fixed it up (I think - see below) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging. You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc mm/mmap.c
index 1b3600152f6f,64b5985b5295..000000000000
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@@ -3116,30 -3132,13 +3112,19 @@@ void exit_mmap(struct mm_struct *mm
set_bit(MMF_OOM_SKIP, &mm->flags);
}

- mmap_write_lock(mm);
+ /*
+ * Actually taking the mmap semaphore here costs 3% performance on
+ * a large machine:
+ * https://lore.kernel.org/lkml/20170725151754.3txp44a2kbffsxdg@xxxxxxxxxxxxxxxxxx/
+ * Lockdep will complain about not holding the mmap_lock, so we lie.
+ */
+ rwsem_acquire(&mm->mmap_lock.dep_map, 0, 0, _THIS_IP_);
- if (mm->locked_vm) {
- mas_for_each(&mas, vma, ULONG_MAX) {
- if (vma->vm_flags & VM_LOCKED) {
- mm->locked_vm -= vma_pages(vma);
- munlock_vma_pages_all(vma);
- }
- }
- mas_set(&mas, 0);
- }
-
arch_exit_mmap(mm);

- vma = mm->mmap;
+ vma = mas_find(&mas, ULONG_MAX);
if (!vma) {
/* Can happen if dup_mmap() received an OOM */
- mmap_write_unlock(mm);
+ rwsem_release(&mm->mmap_lock.dep_map, _THIS_IP_);
return;
}

Attachment: pgpwy6g03aehU.pgp
Description: OpenPGP digital signature