Skip to contentSkip to conversation

mm-vma-document-possible-vma-vm_refcnt-values-and-reference-comment.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jan 31

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled

     Subject: mm/vma: document possible vma->vm_refcnt values and reference comment

has been removed from the -mm tree. Its filename was
mm-vma-document-possible-vma-vm_refcnt-values-and-reference-comment.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 <[email protected]>
Subject: mm/vma: document possible vma->vm_refcnt values and reference comment
Date: Fri, 23 Jan 2026 20:12:12 +0000

The possible vma->vm_refcnt values are confusing and vague, explain in detail what these can be in a comment describing the vma->vm_refcnt field and reference this comment in various places that read/write this field.

No functional change intended.

---

 include/linux/mm_types.h  |   42 ++++++++++++++++++++++++++++++++++--
 include/linux/mmap_lock.h |    7 ++++++
 mm/mmap_lock.c            |    6 +++++
 3 files changed, 53 insertions(+), 2 deletions(-)
include/linux/mmap_lock.h renamed from include/linux/mmap_lock.h~mm-vma-document-possible-vma-vm_refcnt-values-and-reference-comment +7 -0
@@ -130,6 +130,9 @@ static inline bool is_vma_writer_only(in
 	 * attached. Waiting on a detached vma happens only in
 	 * vma_mark_detached() and is a rare case, therefore most of the time
 	 * there will be no unnecessary wakeup.
+	 *
+	 * See the comment describing the vm_area_struct->vm_refcnt field for
+	 * details of possible refcnt values.
 	 */
 	return (refcnt & VM_REFCNT_EXCLUDE_READERS_FLAG) &&
 		refcnt <= VM_REFCNT_EXCLUDE_READERS_FLAG + 1;
@@ -249,6 +252,10 @@ static inline void vma_assert_locked(str
 {
 	unsigned int mm_lock_seq;
 
+	/*
+	 * See the comment describing the vm_area_struct->vm_refcnt field for
+	 * details of possible refcnt values.
+	 */
 	VM_BUG_ON_VMA(refcount_read(&vma->vm_refcnt) <= 1 &&
 		      !__is_vma_write_locked(vma, &mm_lock_seq), vma);
 }
include/linux/mm_types.h renamed from include/linux/mm_types.h~mm-vma-document-possible-vma-vm_refcnt-values-and-reference-comment +40 -2

54 lines not on this page · raw message

mm/mmap_lock.c renamed from mm/mmap_lock.c~mm-vma-document-possible-vma-vm_refcnt-values-and-reference-comment +6 -0
@@ -65,6 +65,9 @@ static inline int __vma_enter_locked(str
 	/*
 	 * If vma is detached then only vma_mark_attached() can raise the
 	 * vm_refcnt. mmap_write_lock prevents racing with vma_mark_attached().
+	 *
+	 * See the comment describing the vm_area_struct->vm_refcnt field for
+	 * details of possible refcnt values.
 	 */
 	if (!refcount_add_not_zero(VM_REFCNT_EXCLUDE_READERS_FLAG, &vma->vm_refcnt))
 		return 0;
@@ -137,6 +140,9 @@ void vma_mark_detached(struct vm_area_st
 	 * before they check vm_lock_seq, realize the vma is locked and drop
 	 * back the vm_refcnt. That is a narrow window for observing a raised
 	 * vm_refcnt.
+	 *
+	 * See the comment describing the vm_area_struct->vm_refcnt field for
+	 * details of possible refcnt values.
 	 */
 	if (unlikely(!refcount_dec_and_test(&vma->vm_refcnt))) {
 		/* Wait until vma is detached with no readers. */

_

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

mm-vma-remove-__private-sparse-decoration-from-vma_flags_t.patch mm-rename-vma_flag_test-set_atomic-to-vma_test-set_atomic_flag.patch mm-add-mk_vma_flags-bitmap-flag-macro-helper.patch tools-bitmap-add-missing-bitmap_.patch mm-add-basic-vma-flag-operation-helper-functions.patch mm-update-hugetlbfs-to-use-vma-flags-on-mmap_prepare.patch mm-update-secretmem-to-use-vma-flags-on-mmap_prepare.patch mm-update-secretmem-to-use-vma-flags-on-mmap_prepare-fix.patch mm-update-shmem__file_-functions-to-use-vma_flags_t.patch mm-update-all-remaining-mmap_prepare-users-to-use-vma_flags_t.patch mm-make-vm_area_desc-utilise-vma_flags_t-only.patch tools-testing-vma-separate-vma-userland-tests-into-separate-files.patch tools-testing-vma-separate-out-vma_internalh-into-logical-headers.patch tools-testing-vma-separate-out-vma_internalh-into-logical-headers-fix.patch tools-testing-vma-add-vma-userland-tests-for-vma-flag-functions.patch