Skip to contentSkip to conversation

mm-introduce-vm_flags_reset_once-to-replace-write_once-vm_flags-updates.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: introduce vm_flags_reset_once to replace WRITE_ONCE vm_flags updates
has been removed from the -mm tree. Its filename was
mm-introduce-vm_flags_reset_once-to-replace-write_once-vm_flags-updates.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: introduce vm_flags_reset_once to replace WRITE_ONCE vm_flags updates
Date: Tue, 31 Jan 2023 16:01:16 -0800

Provide vm_flags_reset_once() and replace the vm_flags updates which used WRITE_ONCE() to prevent compiler optimizations.

Fixes 0cce31a0aa0e ("mm: replace vma->vm_flags direct modifications with modifier calls")

---

 include/linux/mm.h |    7 +++++++
 mm/mlock.c         |    4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-introduce-vm_flags_reset_once-to-replace-write_once-vm_flags-updates +7 -0
@@ -642,6 +642,13 @@ static inline void vm_flags_reset(struct
 	vm_flags_init(vma, flags);
 }
 
+static inline void vm_flags_reset_once(struct vm_area_struct *vma,
+				       vm_flags_t flags)
+{
+	mmap_assert_write_locked(vma->vm_mm);
+	WRITE_ONCE(ACCESS_PRIVATE(vma, __vm_flags), flags);
+}
+
 static inline void vm_flags_set(struct vm_area_struct *vma,
 				vm_flags_t flags)
 {
mm/mlock.c renamed from mm/mlock.c~mm-introduce-vm_flags_reset_once-to-replace-write_once-vm_flags-updates +2 -2
@@ -380,7 +380,7 @@ static void mlock_vma_pages_range(struct
 	 */
 	if (newflags & VM_LOCKED)
 		newflags |= VM_IO;
-	vm_flags_reset(vma, newflags);
+	vm_flags_reset_once(vma, newflags);
 
 	lru_add_drain();
 	walk_page_range(vma->vm_mm, start, end, &mlock_walk_ops, NULL);
@@ -388,7 +388,7 @@ static void mlock_vma_pages_range(struct
 
 	if (newflags & VM_IO) {
 		newflags &= ~VM_IO;
-		vm_flags_reset(vma, newflags);
+		vm_flags_reset_once(vma, newflags);
 	}
 }
 

_

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