Skip to contentSkip to conversation

mm-replace-vm_locked_clear_mask-with-vm_locked_mask.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Feb 10, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: replace VM_LOCKED_CLEAR_MASK with VM_LOCKED_MASK
has been removed from the -mm tree. Its filename was
mm-replace-vm_locked_clear_mask-with-vm_locked_mask.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Suren Baghdasaryan <[email protected]>
Subject: mm: replace VM_LOCKED_CLEAR_MASK with VM_LOCKED_MASK
Date: Thu, 26 Jan 2023 11:37:48 -0800

To simplify the usage of VM_LOCKED_CLEAR_MASK in vm_flags_clear(), replace it with VM_LOCKED_MASK bitmask and convert all users.

Cc Andy Lutomirski <[email protected]>
Cc Arjun Roy <[email protected]>
Cc Axel Rasmussen <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc David Howells <[email protected]>
Cc David Rientjes <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Greg Thelen <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jann Horn <[email protected]>
Cc Joel Fernandes <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Kent Overstreet <[email protected]>
Cc Laurent Dufour <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Peter Oskolkov <[email protected]>
Cc Peter Xu <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Punit Agrawal <[email protected]>
Cc Sebastian Andrzej Siewior <[email protected]>
Cc Sebastian Reichel <[email protected]>
Cc Shakeel Butt <[email protected]>
Cc Soheil Hassas Yeganeh <[email protected]>
Cc Song Liu <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Will Deacon <[email protected]>

---

 include/linux/mm.h |    4 ++--
 kernel/fork.c      |    2 +-
 mm/hugetlb.c       |    4 ++--
 mm/mlock.c         |    6 +++---
 mm/mmap.c          |    6 +++---
 mm/mremap.c        |    2 +-
 6 files changed, 12 insertions(+), 12 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-replace-vm_locked_clear_mask-with-vm_locked_mask +2 -2
@@ -421,8 +421,8 @@ extern unsigned int kobjsize(const void
 /* This mask defines which mm->def_flags a process can inherit its parent */
 #define VM_INIT_DEF_MASK	VM_NOHUGEPAGE
 
-/* This mask is used to clear all the VMA flags used by mlock */
-#define VM_LOCKED_CLEAR_MASK	(~(VM_LOCKED | VM_LOCKONFAULT))
+/* This mask represents all the VMA flag bits used by mlock */
+#define VM_LOCKED_MASK	(VM_LOCKED | VM_LOCKONFAULT)
 
 /* Arch-specific flags to clear when updating VM flags on protection change */
 #ifndef VM_ARCH_CLEAR
kernel/fork.c renamed from kernel/fork.c~mm-replace-vm_locked_clear_mask-with-vm_locked_mask +1 -1
@@ -659,7 +659,7 @@ static __latent_entropy int dup_mmap(str
 			tmp->anon_vma = NULL;
 		} else if (anon_vma_fork(tmp, mpnt))
 			goto fail_nomem_anon_vma_fork;
-		tmp->vm_flags &= ~(VM_LOCKED | VM_LOCKONFAULT);
+		vm_flags_clear(tmp, VM_LOCKED_MASK);
 		file = tmp->vm_file;
 		if (file) {
 			struct address_space *mapping = file->f_mapping;
mm/hugetlb.c renamed from mm/hugetlb.c~mm-replace-vm_locked_clear_mask-with-vm_locked_mask +2 -2
@@ -6969,8 +6969,8 @@ static unsigned long page_table_shareabl
 	unsigned long s_end = sbase + PUD_SIZE;
 
 	/* Allow segments to share if only one is marked locked */
-	unsigned long vm_flags = vma->vm_flags & VM_LOCKED_CLEAR_MASK;
-	unsigned long svm_flags = svma->vm_flags & VM_LOCKED_CLEAR_MASK;
+	unsigned long vm_flags = vma->vm_flags & ~VM_LOCKED_MASK;
+	unsigned long svm_flags = svma->vm_flags & ~VM_LOCKED_MASK;
 
 	/*
 	 * match the virtual addresses, permission and the alignment of the
mm/mlock.c renamed from mm/mlock.c~mm-replace-vm_locked_clear_mask-with-vm_locked_mask +3 -3
@@ -497,7 +497,7 @@ static int apply_vma_lock_flags(unsigned
 		if (vma->vm_start != tmp)
 			return -ENOMEM;
 
-		newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK;
+		newflags = vma->vm_flags & ~VM_LOCKED_MASK;
 		newflags |= flags;
 		/* Here we know that  vma->vm_start <= nstart < vma->vm_end. */
 		tmp = vma->vm_end;
@@ -661,7 +661,7 @@ static int apply_mlockall_flags(int flag
 	struct vm_area_struct *vma, *prev = NULL;
 	vm_flags_t to_add = 0;
 
-	current->mm->def_flags &= VM_LOCKED_CLEAR_MASK;
+	current->mm->def_flags &= ~VM_LOCKED_MASK;
 	if (flags & MCL_FUTURE) {
 		current->mm->def_flags |= VM_LOCKED;
 
@@ -681,7 +681,7 @@ static int apply_mlockall_flags(int flag
 	for_each_vma(vmi, vma) {
 		vm_flags_t newflags;
 
-		newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK;
+		newflags = vma->vm_flags & ~VM_LOCKED_MASK;
 		newflags |= to_add;
 
 		/* Ignore errors */
mm/mmap.c renamed from mm/mmap.c~mm-replace-vm_locked_clear_mask-with-vm_locked_mask +3 -3
@@ -2668,7 +2668,7 @@ expanded:
 		if ((vm_flags & VM_SPECIAL) || vma_is_dax(vma) ||
 					is_vm_hugetlb_page(vma) ||
 					vma == get_gate_vma(current->mm))
-			vma->vm_flags &= VM_LOCKED_CLEAR_MASK;
+			vm_flags_clear(vma, VM_LOCKED_MASK);
 		else
 			mm->locked_vm += (len >> PAGE_SHIFT);
 	}
@@ -3338,8 +3338,8 @@ static struct vm_area_struct *__install_
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;
 
-	vma->vm_flags = vm_flags | mm->def_flags | VM_DONTEXPAND | VM_SOFTDIRTY;
-	vma->vm_flags &= VM_LOCKED_CLEAR_MASK;
+	vm_flags_init(vma, (vm_flags | mm->def_flags |
+		      VM_DONTEXPAND | VM_SOFTDIRTY) & ~VM_LOCKED_MASK);
 	vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
 
 	vma->vm_ops = ops;
mm/mremap.c renamed from mm/mremap.c~mm-replace-vm_locked_clear_mask-with-vm_locked_mask +1 -1
@@ -687,7 +687,7 @@ static unsigned long move_vma(struct vm_
 
 	if (unlikely(!err && (flags & MREMAP_DONTUNMAP))) {
 		/* We always clear VM_LOCKED[ONFAULT] on the old vma */
-		vma->vm_flags &= VM_LOCKED_CLEAR_MASK;
+		vm_flags_clear(vma, VM_LOCKED_MASK);
 
 		/*
 		 * anon_vma links of the old vma is no longer needed after its page

_

Patches currently in -mm which might be from [email protected] are