[merged mm-stable] mm-vma-introduce-and-use-vmg_pages-vmg__pgoff.patch removed from -mm tree
Andrew Morton <[email protected]> Tue, 04 Aug 2026 19:26:04 -0700
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The quilt patch titled
Subject: mm/vma: introduce and use vmg_pages(), vmg_[start, end]_pgoff()
has been removed from the -mm tree. Its filename was
mm-vma-introduce-and-use-vmg_pages-vmg__pgoff.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: introduce and use vmg_pages(), vmg_[start, end]_pgoff()
Date: Fri, 10 Jul 2026 21:16:54 +0100
In the VMA logic we often need to determine the number of pages in the
specified merge range, as well as the start and end page offsets of that
range.
Introduce and use helpers for these purposes.
No functional change intended.
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Lorenzo Stoakes <[email protected]>
Reviewed-by: Pedro Falcato <[email protected]>
Reviewed-by: Gregory Price <[email protected]>
Reviewed-by: Vlastimil Babka (SUSE) <[email protected]>
Reviewed-by: Zi Yan <[email protected]>
Cc: Ackerley Tng <[email protected]>
Cc: David Hildenbrand (Arm) <[email protected]>
Cc: Kai Huang <[email protected]>
Cc: Marek Szyprowski <[email protected]>
Cc: SJ Park <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: Liam R. Howlett (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
mm/vma.c | 11 ++++-------
mm/vma.h | 17 +++++++++++++++++
2 files changed, 21 insertions(+), 7 deletions(-)
--- a/mm/vma.c~mm-vma-introduce-and-use-vmg_pages-vmg__pgoff
+++ a/mm/vma.c
@@ -197,11 +197,9 @@ static void init_multi_vma_prep(struct v
*/
static bool can_vma_merge_before(struct vma_merge_struct *vmg)
{
- pgoff_t pglen = PHYS_PFN(vmg->end - vmg->start);
-
if (is_mergeable_vma(vmg, /* merge_next = */ true) &&
is_mergeable_anon_vma(vmg, /* merge_next = */ true)) {
- if (vmg->next->vm_pgoff == vmg->pgoff + pglen)
+ if (vmg_end_pgoff(vmg) == vma_start_pgoff(vmg->next))
return true;
}
@@ -221,7 +219,7 @@ static bool can_vma_merge_after(struct v
{
if (is_mergeable_vma(vmg, /* merge_next = */ false) &&
is_mergeable_anon_vma(vmg, /* merge_next = */ false)) {
- if (vmg->prev->vm_pgoff + vma_pages(vmg->prev) == vmg->pgoff)
+ if (vma_end_pgoff(vmg->prev) == vmg_start_pgoff(vmg))
return true;
}
return false;
@@ -759,7 +757,7 @@ static int commit_merge(struct vma_merge
*/
vma_adjust_trans_huge(vma, vmg->start, vmg->end,
vmg->__adjust_middle_start ? vmg->middle : NULL);
- vma_set_range(vma, vmg->start, vmg->end, vmg->pgoff);
+ vma_set_range(vma, vmg->start, vmg->end, vmg_start_pgoff(vmg));
vmg_adjust_set_range(vmg);
vma_iter_store_overwrite(vmg->vmi, vmg->target);
@@ -962,8 +960,7 @@ static __must_check struct vm_area_struc
* middle next
* shrink/delete extend
*/
-
- pgoff_t pglen = PHYS_PFN(vmg->end - vmg->start);
+ const pgoff_t pglen = vmg_pages(vmg);
VM_WARN_ON_VMG(!merge_right, vmg);
/* If we are offset into a VMA, then prev must be middle. */
--- a/mm/vma.h~mm-vma-introduce-and-use-vmg_pages-vmg__pgoff
+++ a/mm/vma.h
@@ -230,6 +230,23 @@ static inline bool vmg_nomem(struct vma_
return vmg->state == VMA_MERGE_ERROR_NOMEM;
}
+static inline pgoff_t vmg_start_pgoff(const struct vma_merge_struct *vmg)
+{
+ return vmg->pgoff;
+}
+
+static inline pgoff_t vmg_pages(const struct vma_merge_struct *vmg)
+{
+ const unsigned long size = vmg->end - vmg->start;
+
+ return size >> PAGE_SHIFT;
+}
+
+static inline pgoff_t vmg_end_pgoff(const struct vma_merge_struct *vmg)
+{
+ return vmg_start_pgoff(vmg) + vmg_pages(vmg);
+}
+
/* Assumes addr >= vma->vm_start. */
static inline pgoff_t vma_pgoff_offset(struct vm_area_struct *vma,
unsigned long addr)
_
Patches currently in -mm which might be from [email protected] are
mm-vmalloc-acquire-init_mm-lock-on-huge-vmap-to-avoid-ptdump-uaf.patch
mm-ptdump-always-stabilise-against-page-table-freeing-using-init_mm.patch
arm64-remove-redundant-concurrent-ptdump-uaf-mitigation.patch
mm-huge_memory-fix-huge_zero_pfn-race.patch
mm-huge_memory-separate-out-config_persistent_huge_zero_folio-logic.patch
x86-mm-pat-acquire-init_mm-write-lock-on-collapse-to-avoid-uaf.patch
x86-mm-pat-acquire-init_mm-read-lock-on-attribute-change-to-avoid-uaf.patch
x86-mm-pat-allocate-split-page-tables-as-kernel-page-tables.patch
mm-introduce-vma_flags_can_grow-and-vma_can_grow.patch
mm-vma-update-do_mmap-to-use-vma_flags_t.patch
mm-convert-__get_unmapped_area-to-use-vma_flags_t.patch
mm-update-generic_get_unmapped_area-to-use-vma_flags_t.patch
mm-prefer-mm-def_vma_flags-in-mm-logic.patch
mm-vma-convert-vm_pgprot_modify-to-use-vma_flags_t-and-rename.patch
mm-vma-rename-vma_get_page_prot-to-vma_flags_to_page_prot.patch
mm-introduce-vma_get_page_prot-and-use-it.patch
mm-vma-update-create_init_stack_vma-to-use-vma_flags_t.patch
mm-vma-convert-miscellaneous-uses-of-vma-flags-in-core-mm.patch
mm-mlock-convert-mlock-code-to-use-vma_flags_t.patch
mm-mprotect-convert-mprotect-code-to-use-vma_flags_t.patch
mm-mremap-convert-mremap-code-to-use-vma_flags_t.patch
mm-mseal-remove-superfluous-comments-fix-confusion-around-mm.patch
mm-mseal-limit-scope-of-mseal-address-zero-to-address-zero.patch
mm-mseal-remove-further-superfluous-comments-do_mseal.patch
mm-vma-introduce-vma-virtual-page-offset-field-and-add-helpers.patch
mm-introduce-linear_virt_page_index.patch
mm-abstract-vma_address-and-introduce-vma_anon_address.patch
mm-update-print_bad_page_map-to-show-virtual-page-index.patch
mm-introduce-and-use-vma_filebacked_address.patch
mm-propagate-vma-virtual-page-offset-on-map-remap-split-merge.patch
mm-rmap-track-whether-the-page-vma-mapped-walk-is-anonymous.patch
mm-introduce-and-use-linear_folio_page_index.patch
mm-rmap-use-virt-pgoff-for-map_private-file-backed-anon-folios.patch
tools-testing-vma-expand-vma-merge-tests-to-assert-virt-pgoff.patch
tools-testing-selftests-mm-test-virtual-page-offset-merge-behaviour.patch
mm-vma-only-permit-map_private-dev-zero-to-be-mapped-anonymous.patch
mm-vma-make-map_private-mapped-dev-zero-mappings-truly-anonymous.patch
tools-testing-vma-add-test-to-assert-map_private-dev-zero-is-anon.patch
tools-testing-selftests-mm-add-map_private-dev-zero-merge-tests.patch
mm-add-some-missing-includes-to-mm-local-headers.patch