Skip to contentSkip to conversation

mm-move-vma_mmu_pagesize-from-hugetlb-to-vmac.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 29

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: move vma_mmu_pagesize() from hugetlb to vma.c
has been removed from the -mm tree. Its filename was
mm-move-vma_mmu_pagesize-from-hugetlb-to-vmac.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: "David Hildenbrand (Arm)" <[email protected]>
Subject: mm: move vma_mmu_pagesize() from hugetlb to vma.c
Date: Mon, 9 Mar 2026 16:18:59 +0100

vma_mmu_pagesize() is also queried on non-hugetlb VMAs and does not really belong into hugetlb.c.

PPC64 provides a custom overwrite with CONFIG_HUGETLB_PAGE, see arch/powerpc/mm/book3s64/slice.c, so we cannot easily make this a static inline function.

So let's move it to vma.c and add some proper kerneldoc.

To make vma tests happy, add a simple vma_kernel_pagesize() stub in tools/testing/vma/include/custom.h.

Cc "Christophe Leroy (CS GROUP)" <[email protected]>
Cc Dan Williams <[email protected]>
Cc Jann Horn <[email protected]>
Cc Liam Howlett <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Muchun Song <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Pedro Falcato <[email protected]>
Cc Suren Baghdasaryan <[email protected]>

---

 include/linux/hugetlb.h            |    7 -------
 include/linux/mm.h                 |    2 ++
 mm/hugetlb.c                       |   11 -----------
 mm/vma.c                           |   21 +++++++++++++++++++++
 tools/testing/vma/include/custom.h |    5 +++++
 5 files changed, 28 insertions(+), 18 deletions(-)
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~mm-move-vma_mmu_pagesize-from-hugetlb-to-vmac +0 -7
@@ -777,8 +777,6 @@ static inline unsigned long huge_page_si
 	return (unsigned long)PAGE_SIZE << h->order;
 }
 
-extern unsigned long vma_mmu_pagesize(struct vm_area_struct *vma);
-
 static inline unsigned long huge_page_mask(struct hstate *h)
 {
 	return h->mask;
@@ -1175,11 +1173,6 @@ static inline unsigned long huge_page_ma
 	return PAGE_MASK;
 }
 
-static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
-{
-	return PAGE_SIZE;
-}
-
 static inline unsigned int huge_page_order(struct hstate *h)
 {
 	return 0;
include/linux/mm.h renamed from include/linux/mm.h~mm-move-vma_mmu_pagesize-from-hugetlb-to-vmac +2 -0
@@ -1371,6 +1371,8 @@ static inline unsigned long vma_kernel_p
 	return PAGE_SIZE;
 }
 
+unsigned long vma_mmu_pagesize(struct vm_area_struct *vma);
+
 static inline
 struct vm_area_struct *vma_find(struct vma_iterator *vmi, unsigned long max)
 {
mm/hugetlb.c renamed from mm/hugetlb.c~mm-move-vma_mmu_pagesize-from-hugetlb-to-vmac +0 -11
@@ -1018,17 +1018,6 @@ static pgoff_t vma_hugecache_offset(stru
 }
 
 /*
- * Return the page size being used by the MMU to back a VMA. In the majority
- * of cases, the page size used by the kernel matches the MMU size. On
- * architectures where it differs, an architecture-specific 'strong'
- * version of this symbol is required.
- */
-__weak unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
-{
-	return vma_kernel_pagesize(vma);
-}
-
-/*
  * Flags for MAP_PRIVATE reservations.  These are stored in the bottom
  * bits of the reservation map pointer, which are always clear due to
  * alignment.
mm/vma.c renamed from mm/vma.c~mm-move-vma_mmu_pagesize-from-hugetlb-to-vmac +21 -0
@@ -3300,3 +3300,24 @@ int insert_vm_struct(struct mm_struct *m
 
 	return 0;
 }
+
+/**
+ * vma_mmu_pagesize - Default MMU page size granularity for this VMA.
+ * @vma: The user mapping.
+ *
+ * In the common case, the default page size used by the MMU matches the
+ * default page size used by the kernel (see vma_kernel_pagesize()). On
+ * architectures where it differs, an architecture-specific 'strong' version
+ * of this symbol is required.
+ *
+ * The default MMU page size is not affected by Transparent Huge Pages
+ * being in effect, or any usage of larger MMU page sizes (either through
+ * architectural huge-page mappings or other explicit/implicit coalescing of
+ * virtual ranges performed by the MMU).
+ *
+ * Return: The default MMU page size granularity for this VMA.
+ */
+__weak unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
+{
+	return vma_kernel_pagesize(vma);
+}
tools/testing/vma/include/custom.h renamed from tools/testing/vma/include/custom.h~mm-move-vma_mmu_pagesize-from-hugetlb-to-vmac +5 -0
@@ -118,3 +118,8 @@ static __always_inline vma_flags_t __mk_
 			vma_flags_set_flag(&flags, bits[i]);
 	return flags;
 }
+
+static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
+{
+	return PAGE_SIZE;
+}

_

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