Skip to contentSkip to conversation

mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 24

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: update comments to refer to anon rmap rather than anon_vma
has been removed from the -mm tree. Its filename was
mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma.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: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: mm: update comments to refer to anon rmap rather than anon_vma
Date: Thu, 17 Sep 2026 20:47:43 +0100

Now that vma_has_anon_rmap() abstracts whether a VMA has an anonymous reverse mapping, remove references to anon_vma and instead reference the anon rmap.

The anon_vma is an implementation detail and should be treated as such.

Do not update mm/rmap.c which implements the anon_vma mechanism as it is reasonable to directly reference it there.

No functional change intended.

[[email protected]: fix comment, per Zi Yan]
Cc Alistair Popple <[email protected]>
Cc Baolin Wang <[email protected]>
Cc Baoquan He <[email protected]>
Cc Barry Song <[email protected]>
Cc Byungchul Park <[email protected]>
Cc Chengming Zhou <[email protected]>
Cc Chris Li <[email protected]>
Cc Dev Jain <[email protected]>
Cc Gregory Price <[email protected]>
Cc Guilherme Giacomo Simoes <[email protected]>
Cc Harry Yoo <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Jann Horn <[email protected]>
Cc Joshua Hahn <[email protected]>
Cc Kairui Song <[email protected]>
Cc Kemeng Shi <[email protected]>
Cc Kiryl Shutsemau <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Muchun Song <[email protected]>
Cc Nhat Pham <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Peter Xu <[email protected]>
Cc Rakie Kim <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Shakeel Butt <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc xu xin <[email protected]>
Cc Zi Yan <[email protected]>

---

 mm/huge_memory.c     |    8 +--
 mm/hugetlb.c         |    2 
 mm/khugepaged.c      |   12 ++---
 mm/ksm.c             |    6 +-
 mm/madvise.c         |    6 +-
 mm/memory.c          |   12 ++---
 mm/migrate.c         |   12 ++---
 mm/mmap.c            |    6 +-
 mm/mprotect.c        |    4 -
 mm/mremap.c          |    6 +-
 mm/pgtable-generic.c |    2 
 mm/userfaultfd.c     |   10 ++--
 mm/vma.c             |   98 ++++++++++++++++++++---------------------
 13 files changed, 92 insertions(+), 92 deletions(-)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +4 -4
@@ -253,10 +253,10 @@ unsigned long __thp_vma_allowable_orders
 
 	/*
 	 * THPeligible bit of smaps should show 1 for proper VMAs even
-	 * though anon_vma is not initialized yet.
+	 * though they don't have an anon rmap yet.
 	 *
-	 * Allow page fault since anon_vma may be not initialized until
-	 * the first page fault.
+	 * Allow page fault since the VMA may not have an anon rmap until the
+	 * first page fault.
 	 */
 	if (!vma_has_anon_rmap(vma))
 		return (smaps || in_pf) ? orders : 0;
@@ -4372,7 +4372,7 @@ out:
  * THP pages in the middle of migration, due to allocation issues on either
  * side.
  *
- * anon_vma_lock is not required to be held, mmap_read_lock() or
+ * The anon rmap lock is not required to be held, mmap_read_lock() or
  * mmap_write_lock() should be held. @folio is expected to be locked by the
  * caller. device-private and non device-private folios are supported along
  * with folios that are in the swapcache. @folio should also be unmapped and
mm/hugetlb.c renamed from mm/hugetlb.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +1 -1
@@ -5692,7 +5692,7 @@ retry_avoidcopy:
 
 	/*
 	 * When the original hugepage is shared one, it does not have
-	 * anon_vma prepared.
+	 * an anon rmap prepared.
 	 */
 	ret = __vmf_anon_prepare(vmf);
 	if (unlikely(ret))
mm/khugepaged.c renamed from mm/khugepaged.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +6 -6
@@ -1365,7 +1365,7 @@ static enum scan_result collapse_huge_pa
 	/*
 	 * Prevent all access to pagetables with the exception of
 	 * gup_fast later handled by the pmdp_collapse_flush() and the VM
-	 * handled by the anon_vma lock + folio lock.
+	 * handled by the anon rmap lock + folio lock.
 	 *
 	 * UFFDIO_MOVE is prevented to race as well thanks to the
 	 * mmap_lock.
@@ -1432,8 +1432,8 @@ static enum scan_result collapse_huge_pa
 	}
 
 	/*
-	 * For PMD collapse all pages are isolated and locked so anon_vma
-	 * rmap can't run anymore. For mTHP collapse the PMD entry has been
+	 * For PMD collapse all pages are isolated and locked so the anon
+	 * rmap walk can't run anymore. For mTHP collapse the PMD entry has been
 	 * removed and not all pages are isolated and locked, so we must hold
 	 * the lock to prevent neighboring folios from attempting to access
 	 * this PMD until its reinstalled.
@@ -2226,9 +2226,9 @@ static void retract_page_tables(struct a
 
 		/*
 		 * Huge page lock is still held, so normally the page table must
-		 * remain empty; and we have already skipped anon_vma and
-		 * userfaultfd_wp() vmas.  But since the mmap_lock is not held,
-		 * it is still possible for a racing userfaultfd_ioctl() or
+		 * remain empty; and we have already skipped vmas with an anon
+		 * rmap and userfaultfd_wp() vmas.  But since the mmap_lock is not
+		 * held, it is still possible for a racing userfaultfd_ioctl() or
 		 * madvise() to have inserted ptes or markers.  Now that we hold
 		 * ptlock, repeating the retractable checks protects us from
 		 * races against the prior checks.
mm/ksm.c renamed from mm/ksm.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +3 -3
@@ -796,7 +796,7 @@ static void break_cow(struct ksm_rmap_it
 
 	/*
 	 * It is not an accident that whenever we want to break COW
-	 * to undo, we also need to drop a reference to the anon_vma.
+	 * to undo, we also need to drop a reference to the anon rmap.
 	 */
 	put_anon_vma(rmap_item->anon_vma);
 	/*
@@ -1416,7 +1416,7 @@ static int replace_page(struct vm_area_s
 		goto out;
 	/*
 	 * Some THP functions use the sequence pmdp_huge_clear_flush(), set_pmd_at()
-	 * without holding anon_vma lock for write.  So when looking for a
+	 * without holding the anon rmap lock for write.  So when looking for a
 	 * genuine pmde (in which to find pte), test present and !THP together.
 	 */
 	pmde = pmdp_get_lockless(pmd);
@@ -1620,7 +1620,7 @@ static int try_to_merge_with_ksm_page(st
 
 	/*
 	 * We can consider the VMA only while still holding the mmap lock,
-	 * so lock, so reference the anon_vma and calculate the linear
+	 * so reference the anon rmap and calculate the linear
 	 * page index early, before stable_tree_append(). If anything goes
 	 * wrong that prevents the rmap_item from being added to the
 	 * stable_tree, break_cow() will clean it up.
mm/madvise.c renamed from mm/madvise.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +3 -3
@@ -1158,7 +1158,7 @@ static long madvise_guard_install(struct
 
 	/*
 	 * If anonymous and we are establishing page tables the VMA ought to
-	 * have an anon_vma associated with it.
+	 * have an anon rmap associated with it.
 	 *
 	 * We will hold an mmap read lock if this is necessary, this is checked
 	 * as part of the VMA lock logic.
@@ -1626,8 +1626,8 @@ static bool is_vma_lock_sufficient(struc
 	 * anon_vma_prepare() explicitly requires an mmap lock for
 	 * serialisation, so we cannot use a VMA lock in this case.
 	 *
-	 * Note we might race with anon_vma being set, however this makes this
-	 * check overly paranoid which is safe.
+	 * Note we might race with the anon rmap being assigned, however this
+	 * makes this check overly paranoid which is safe.
 	 */
 	if (vma_is_anonymous(vma) &&
 	    prepares_anon_vma(madv_behavior->behavior) && !vma_has_anon_rmap(vma))
mm/memory.c renamed from mm/memory.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +6 -6
@@ -1291,8 +1291,8 @@ again:
 	 * copy_pmd_range()'s prior pmd_none_or_clear_bad(src_pmd), and the
 	 * error handling here, assume that exclusive mmap_lock on dst and src
 	 * protects anon from unexpected THP transitions; with shmem and file
-	 * protected by mmap_lock-less collapse skipping areas with anon_vma
-	 * (whereas vma_needs_copy() skips areas without anon_vma).  A rework
+	 * protected by mmap_lock-less collapse skipping areas with an anon rmap
+	 * (whereas vma_needs_copy() skips areas without one).  A rework
 	 * can remove such assumptions later, but this is good enough for now.
 	 */
 	dst_pte = pte_alloc_map_lock(dst_mm, dst_pmd, addr, &dst_ptl);
@@ -1533,8 +1533,8 @@ vma_needs_copy(struct vm_area_struct *ds
 	if (dst_vma->vm_flags & VM_COPY_ON_FORK)
 		return true;
 	/*
-	 * The presence of an anon_vma indicates an anonymous VMA has page
-	 * tables which naturally cannot be reconstituted on page fault.
+	 * The presence of an anon rmap indicates the VMA may map anonymous
+	 * folios which naturally cannot be reconstituted on page fault.
 	 */
 	if (vma_has_anon_rmap(src_vma))
 		return true;
@@ -4001,10 +4001,10 @@ static inline vm_fault_t vmf_can_call_fa
  *
  * When preparing to insert an anonymous page into a VMA from a
  * fault handler, call this function rather than anon_vma_prepare().
- * If this vma does not already have an associated anon_vma and we are
+ * If this vma does not already have an anon rmap and we are
  * only protected by the per-VMA lock, the caller must retry with the
  * mmap_lock held.  __anon_vma_prepare() will look at adjacent VMAs to
- * determine if this VMA can share its anon_vma, and that's not safe to
+ * determine if this VMA can share its anon rmap, and that's not safe to
  * do with only the per-VMA lock held for this VMA.
  *
  * Return: 0 if fault handling can proceed.  Any other value should be
mm/migrate.c renamed from mm/migrate.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +6 -6
@@ -1174,7 +1174,7 @@ static void migrate_folio_undo_src(struc
 {
 	if (was_mapped)
 		remove_migration_ptes(src, src, 0);
-	/* Drop an anon_vma reference if we took one */
+	/* Drop an anon rmap reference if we took one */
 	if (anon_vma)
 		put_anon_vma(anon_vma);
 	if (locked)
@@ -1281,15 +1281,15 @@ static int migrate_folio_unmap(new_folio
 
 	/*
 	 * By try_to_migrate(), src->mapcount goes down to 0 here. In this case,
-	 * we cannot notice that anon_vma is freed while we migrate a page.
-	 * This get_anon_vma() delays freeing anon_vma pointer until the end
+	 * we cannot notice that the anon rmap is freed while we migrate a page.
+	 * This get_anon_vma() delays freeing the anon rmap until the end
 	 * of migration. File cache pages are no problem because of page_lock()
 	 * File Caches may use write_page() or lock_page() in migration, then,
 	 * just care Anon page here.
 	 *
 	 * Only folio_get_anon_vma() understands the subtleties of
-	 * getting a hold on an anon_vma from outside one of its mms.
-	 * But if we cannot get anon_vma, then we won't need it anyway,
+	 * getting a hold on an anon rmap from outside one of its mms.
+	 * But if we cannot get the anon rmap, then we won't need it anyway,
 	 * because that implies that the anon page is no longer mapped
 	 * (and cannot be remapped so long as we hold the page lock).
 	 */
@@ -1432,7 +1432,7 @@ out_unlock_both:
 	 * and will be freed.
 	 */
 	list_del(&src->lru);
-	/* Drop an anon_vma reference if we took one */
+	/* Drop an anon rmap reference if we took one */
 	if (anon_vma)
 		put_anon_vma(anon_vma);
 	folio_unlock(src);
mm/mmap.c renamed from mm/mmap.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +3 -3
@@ -547,7 +547,7 @@ unsigned long do_mmap(struct file *file,
 		}
 		case MAP_PRIVATE:
 			/*
-			 * Set pgoff according to addr for anon_vma.
+			 * Set pgoff according to addr for the anon rmap.
 			 */
 			pgoff = addr >> PAGE_SHIFT;
 			break;
@@ -1774,8 +1774,8 @@ __latent_entropy int dup_mmap(struct mm_
 		if (vma_test(tmp, VMA_WIPEONFORK_BIT)) {
 			/*
 			 * VMA_WIPEONFORK_BIT gets a clean slate in the child.
-			 * Don't prepare anon_vma until fault since we don't
-			 * copy page for current vma.
+			 * Don't prepare the anon rmap until fault since we
+			 * don't copy pages for the current vma.
 			 */
 			tmp->anon_vma = NULL;
 		} else if (anon_vma_fork(tmp, mpnt))
mm/mprotect.c renamed from mm/mprotect.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +2 -2
@@ -796,8 +796,8 @@ mprotect_fixup(struct vma_iterator *vmi,
 	/*
 	 * If we make a private mapping writable we increase our commit;
 	 * but (without finer accounting) cannot reduce our commit if we
-	 * make it unwritable again except in the anonymous case where no
-	 * anon_vma has yet to be assigned.
+	 * make it unwritable again except in the anonymous case where the
+	 * VMA's anon rmap has yet to be assigned.
 	 *
 	 * hugetlb mapping were accounted for even if read-only so there is
 	 * no need to account for them here.
mm/mremap.c renamed from mm/mremap.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +3 -3
@@ -214,7 +214,7 @@ static int move_ptes(struct pagetable_mo
 	int err = 0;
 
 	/*
-	 * When need_rmap_locks is true, we take the i_mmap_rwsem and anon_vma
+	 * When need_rmap_locks is true, we take the i_mmap_rwsem and anon rmap
 	 * locks to ensure that rmap will always observe either the old or the
 	 * new ptes. This is the easiest way to avoid races with
 	 * truncate_pagecache(), page migration, etc...
@@ -1373,8 +1373,8 @@ static void dontunmap_complete(struct vm
 	vma_clear_flags_mask(vma, VMA_LOCKED_MASK);
 
 	/*
-	 * anon_vma links of the old vma is no longer needed after its page
-	 * table has been moved.
+	 * The anon rmap links of the old vma are no longer needed after its
+	 * page table has been moved.
 	 */
 	if (start == old_start && end == old_end) {
 		const pgoff_t pgoff_unfaulted = vma->vm_start >> PAGE_SHIFT;
mm/pgtable-generic.c renamed from mm/pgtable-generic.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +1 -1
@@ -349,7 +349,7 @@ pte_t *pte_offset_map_rw_nolock(struct m
  * pte_offset_map_lock(mm, pmd, addr, ptlp) is usually called with the pmd
  * pointer for addr, reached by walking down the mm's pgd, p4d, pud for addr:
  * either while holding mmap_lock or vma lock for read or for write; or in
- * truncate or rmap context, while holding file's i_mmap_lock or anon_vma lock
+ * truncate or rmap context, while holding file's i_mmap_lock or anon rmap lock
  * for read (or for write). In a few cases, it may be used with pmd pointing to
  * a pmd_t already copied to or constructed on the stack.
  *
mm/userfaultfd.c renamed from mm/userfaultfd.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +5 -5
@@ -130,7 +130,7 @@ struct vm_area_struct *find_vma_and_prep
  * Should be called without holding mmap_lock.
  *
  * Return: A locked vma containing @address, -ENOENT if no vma is found,
- * -ENOMEM if anon_vma couldn't be allocated, or -EAGAIN if vma refcount
+ * -ENOMEM if the anon rmap couldn't be allocated, or -EAGAIN if vma refcount
  * overflow happened due to high number of readers and the caller should
  * retry later.
  */
@@ -142,8 +142,8 @@ static struct vm_area_struct *uffd_lock_
 	vma = lock_vma_under_rcu(mm, address);
 	if (vma) {
 		/*
-		 * We know we're going to need to use anon_vma, so check
-		 * that early.
+		 * We know we're going to need an anon rmap, so check that
+		 * early.
 		 */
 		if (!(vma->vm_flags & VM_SHARED) && unlikely(!vma_has_anon_rmap(vma)))
 			vma_end_read(vma);
@@ -1680,7 +1680,7 @@ retry:
 		/*
 		 * Verify the existence of the swapcache. If present, the folio's
 		 * index and mapping must be updated even when the PTE is a swap
-		 * entry. The anon_vma lock is not taken during this process since
+		 * entry. The anon rmap lock is not taken during this process since
 		 * the folio has already been unmapped, and the swap entry is
 		 * exclusive, preventing rmap walks.
 		 *
@@ -1915,7 +1915,7 @@ static void uffd_move_unlock(struct vm_a
  *
  * move_pages() remaps arbitrary anonymous pages atomically in zero
  * copy. It only works on non shared anonymous pages because those can
- * be relocated without generating non linear anon_vmas in the rmap
+ * be relocated without generating non linear anon rmaps in the rmap
  * code.
  *
  * It provides a zero copy mechanism to handle userspace page faults.
mm/vma.c renamed from mm/vma.c~mm-update-comments-to-refer-to-anon-rmap-rather-than-anon_vma +49 -49

285 lines not on this page · raw message

_

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

mm-vma-fix-expansion-of-vma_mixedmap_bit-vmas.patch mm-do-not-unintentionally-overwrite-atomic-vma-flags.patch mm-vma-avoid-losing-atomic-vma-flags-when-setting-sticky-vma-flags.patch