Skip to contentSkip to conversation

userfaultfd-remove-write_once-when-setting-folio-index-during-uffdio_move.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 6, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled

     Subject: userfaultfd: remove WRITE_ONCE when setting folio->index during UFFDIO_MOVE

has been removed from the -mm tree. Its filename was
userfaultfd-remove-write_once-when-setting-folio-index-during-uffdio_move.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: userfaultfd: remove WRITE_ONCE when setting folio->index during UFFDIO_MOVE
Date: Sun, 14 Apr 2024 19:08:21 -0700

When folio is moved with UFFDIO_MOVE it gets locked before the rmap and index are modified. Due to the folio lock being already held, WRITE_ONCE() is not needed when setting the folio index. Remove it.

---

 mm/huge_memory.c |    2 +-
 mm/userfaultfd.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
mm/huge_memory.c renamed from mm/huge_memory.c~userfaultfd-remove-write_once-when-setting-folio-index-during-uffdio_move +1 -1
@@ -2200,7 +2200,7 @@ int move_pages_huge_pmd(struct mm_struct
 		}
 
 		folio_move_anon_rmap(src_folio, dst_vma);
-		WRITE_ONCE(src_folio->index, linear_page_index(dst_vma, dst_addr));
+		src_folio->index = linear_page_index(dst_vma, dst_addr);
 
 		_dst_pmd = mk_huge_pmd(&src_folio->page, dst_vma->vm_page_prot);
 		/* Follow mremap() behavior and treat the entry dirty after the move */
mm/userfaultfd.c renamed from mm/userfaultfd.c~userfaultfd-remove-write_once-when-setting-folio-index-during-uffdio_move +1 -1
@@ -1026,7 +1026,7 @@ static int move_present_pte(struct mm_st
 	}
 
 	folio_move_anon_rmap(src_folio, dst_vma);
-	WRITE_ONCE(src_folio->index, linear_page_index(dst_vma, dst_addr));
+	src_folio->index = linear_page_index(dst_vma, dst_addr);
 
 	orig_dst_pte = mk_pte(&src_folio->page, dst_vma->vm_page_prot);
 	/* Follow mremap() behavior and treat the entry dirty after the move */

_

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