* [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c
@ 2026-03-06 10:15 David Hildenbrand (Arm)
2026-03-06 10:15 ` [PATCH v1 1/4] mm: move vma_kernel_pagesize() from hugetlb to mm.h David Hildenbrand (Arm)
` (5 more replies)
0 siblings, 6 replies; 15+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-06 10:15 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, kvm, David Hildenbrand (Arm),
Andrew Morton, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Muchun Song, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jann Horn, Pedro Falcato, Paolo Bonzini, Dan Williams
Looking into vma_(kernel|mmu)_pagesize(), I realized that there is one
scenario where DAX would not do the right thing when the kernel is
not compiled with hugetlb support.
Without hugetlb support, vma_(kernel|mmu)_pagesize() will always return
PAGE_SIZE instead of using the ->pagesize() result provided by dax-device
code.
Fix that by moving vma_kernel_pagesize() to core MM code, where it belongs.
I don't think this is stable material, but am not 100% sure.
Also, move vma_mmu_pagesize() while at it. Remove the unnecessary hugetlb.h
inclusion from KVM code.
Cross-compiled heavily.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
David Hildenbrand (Arm) (4):
mm: move vma_kernel_pagesize() from hugetlb to mm.h
mm: move vma_mmu_pagesize() from hugetlb to vma.c
KVM: remove hugetlb.h inclusion
KVM: PPC: remove hugetlb.h inclusion
arch/powerpc/kvm/book3s_hv.c | 1 -
include/linux/hugetlb.h | 14 --------------
include/linux/mm.h | 22 ++++++++++++++++++++++
mm/hugetlb.c | 28 ----------------------------
mm/vma.c | 21 +++++++++++++++++++++
virt/kvm/kvm_main.c | 1 -
6 files changed, 43 insertions(+), 44 deletions(-)
base-commit: f75825cdfc4c5477cffcfd2cafa4e5ce5aa67f13
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v1 1/4] mm: move vma_kernel_pagesize() from hugetlb to mm.h
2026-03-06 10:15 [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c David Hildenbrand (Arm)
@ 2026-03-06 10:15 ` David Hildenbrand (Arm)
2026-03-06 11:07 ` Lorenzo Stoakes (Oracle)
2026-03-06 10:15 ` [PATCH v1 2/4] mm: move vma_mmu_pagesize() from hugetlb to vma.c David Hildenbrand (Arm)
` (4 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-06 10:15 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, kvm, David Hildenbrand (Arm), Dan Williams
In the past, only hugetlb had special "vma_kernel_pagesize()"
requirements, so it provided its own implementation.
In commit 05ea88608d4e ("mm, hugetlbfs: introduce ->pagesize() to
vm_operations_struct") we generalized that approach by providing a
vm_ops->pagesize() callback to be used by device-dax.
Once device-dax started using that callback in commit c1d53b92b95c
("device-dax: implement ->pagesize() for smaps to report MMUPageSize")
it was missed that CONFIG_DEV_DAX does not depend on hugetlb support.
So building a kernel with CONFIG_DEV_DAX but without CONFIG_HUGETLBFS
would not pick up that value.
Fix it by moving vma_kernel_pagesize() to mm.h, providing only a single
implementation. While at it, improve the kerneldoc a bit.
Ideally, we'd move vma_mmu_pagesize() as well to the header. However,
its __weak symbol might be overwritten by a PPC variant in hugetlb code.
So let's leave it in there for now, as it really only matters for some
hugetlb oddities.
This was found by code inspection.
Fixes: c1d53b92b95c ("device-dax: implement ->pagesize() for smaps to report MMUPageSize")
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
include/linux/hugetlb.h | 7 -------
include/linux/mm.h | 20 ++++++++++++++++++++
mm/hugetlb.c | 17 -----------------
3 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 65910437be1c..44c1848a2c21 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -777,8 +777,6 @@ static inline unsigned long huge_page_size(const struct hstate *h)
return (unsigned long)PAGE_SIZE << h->order;
}
-extern unsigned long vma_kernel_pagesize(struct vm_area_struct *vma);
-
extern unsigned long vma_mmu_pagesize(struct vm_area_struct *vma);
static inline unsigned long huge_page_mask(struct hstate *h)
@@ -1177,11 +1175,6 @@ static inline unsigned long huge_page_mask(struct hstate *h)
return PAGE_MASK;
}
-static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
-{
- return PAGE_SIZE;
-}
-
static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
{
return PAGE_SIZE;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 44e04a42fe77..227809790f1a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1307,6 +1307,26 @@ static inline bool vma_is_shared_maywrite(const struct vm_area_struct *vma)
return is_shared_maywrite(&vma->flags);
}
+/**
+ * vma_kernel_pagesize - Default page size granularity for this VMA.
+ * @vma: The user mapping.
+ *
+ * The kernel page size specifies in which granularity VMA modifications
+ * can be performed. Folios in this VMA will be aligned to, and at least
+ * the size of the number of bytes returned by this function.
+ *
+ * The default kernel page size is not affected by Transparent Huge Pages
+ * being in effect.
+ *
+ * Return: The default page size granularity for this VMA.
+ */
+static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
+{
+ if (unlikely(vma->vm_ops && vma->vm_ops->pagesize))
+ return vma->vm_ops->pagesize(vma);
+ return PAGE_SIZE;
+}
+
static inline
struct vm_area_struct *vma_find(struct vma_iterator *vmi, unsigned long max)
{
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 1d41fa3dd43e..66eadfa9e958 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1017,23 +1017,6 @@ static pgoff_t vma_hugecache_offset(struct hstate *h,
(vma->vm_pgoff >> huge_page_order(h));
}
-/**
- * vma_kernel_pagesize - Page size granularity for this VMA.
- * @vma: The user mapping.
- *
- * Folios in this VMA will be aligned to, and at least the size of the
- * number of bytes returned by this function.
- *
- * Return: The default size of the folios allocated when backing a VMA.
- */
-unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
-{
- if (vma->vm_ops && vma->vm_ops->pagesize)
- return vma->vm_ops->pagesize(vma);
- return PAGE_SIZE;
-}
-EXPORT_SYMBOL_GPL(vma_kernel_pagesize);
-
/*
* 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
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v1 2/4] mm: move vma_mmu_pagesize() from hugetlb to vma.c
2026-03-06 10:15 [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c David Hildenbrand (Arm)
2026-03-06 10:15 ` [PATCH v1 1/4] mm: move vma_kernel_pagesize() from hugetlb to mm.h David Hildenbrand (Arm)
@ 2026-03-06 10:15 ` David Hildenbrand (Arm)
2026-03-06 11:11 ` Lorenzo Stoakes (Oracle)
2026-03-06 10:15 ` [PATCH v1 3/4] KVM: remove hugetlb.h inclusion David Hildenbrand (Arm)
` (3 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-06 10:15 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-mm, linuxppc-dev, kvm, David Hildenbrand (Arm)
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.
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
include/linux/hugetlb.h | 7 -------
include/linux/mm.h | 2 ++
mm/hugetlb.c | 11 -----------
mm/vma.c | 21 +++++++++++++++++++++
4 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 44c1848a2c21..aaf3d472e6b5 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -777,8 +777,6 @@ static inline unsigned long huge_page_size(const struct hstate *h)
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_mask(struct hstate *h)
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;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 227809790f1a..22d338933c84 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1327,6 +1327,8 @@ static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
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)
{
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 66eadfa9e958..f6ecca9aae01 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1017,17 +1017,6 @@ static pgoff_t vma_hugecache_offset(struct hstate *h,
(vma->vm_pgoff >> huge_page_order(h));
}
-/*
- * 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
diff --git a/mm/vma.c b/mm/vma.c
index be64f781a3aa..e95fd5a5fe5c 100644
--- a/mm/vma.c
+++ b/mm/vma.c
@@ -3300,3 +3300,24 @@ int insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma)
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);
+}
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v1 3/4] KVM: remove hugetlb.h inclusion
2026-03-06 10:15 [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c David Hildenbrand (Arm)
2026-03-06 10:15 ` [PATCH v1 1/4] mm: move vma_kernel_pagesize() from hugetlb to mm.h David Hildenbrand (Arm)
2026-03-06 10:15 ` [PATCH v1 2/4] mm: move vma_mmu_pagesize() from hugetlb to vma.c David Hildenbrand (Arm)
@ 2026-03-06 10:15 ` David Hildenbrand (Arm)
2026-03-06 11:11 ` Lorenzo Stoakes (Oracle)
2026-03-06 10:16 ` [PATCH v1 4/4] KVM: PPC: " David Hildenbrand (Arm)
` (2 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-06 10:15 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-mm, linuxppc-dev, kvm, David Hildenbrand (Arm)
hugetlb.h is no longer required now that we moved vma_kernel_pagesize()
to mm.h.
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
virt/kvm/kvm_main.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 22f8a672e1fd..58059648b881 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -41,7 +41,6 @@
#include <linux/spinlock.h>
#include <linux/compat.h>
#include <linux/srcu.h>
-#include <linux/hugetlb.h>
#include <linux/slab.h>
#include <linux/sort.h>
#include <linux/bsearch.h>
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v1 4/4] KVM: PPC: remove hugetlb.h inclusion
2026-03-06 10:15 [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c David Hildenbrand (Arm)
` (2 preceding siblings ...)
2026-03-06 10:15 ` [PATCH v1 3/4] KVM: remove hugetlb.h inclusion David Hildenbrand (Arm)
@ 2026-03-06 10:16 ` David Hildenbrand (Arm)
2026-03-06 11:12 ` Lorenzo Stoakes (Oracle)
2026-03-06 11:13 ` [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c Pedro Falcato
2026-03-06 15:30 ` Mike Rapoport
5 siblings, 1 reply; 15+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-06 10:16 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-mm, linuxppc-dev, kvm, David Hildenbrand (Arm)
hugetlb.h is no longer required now that we moved vma_kernel_pagesize()
to mm.h.
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
arch/powerpc/kvm/book3s_hv.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 08e5816fdd61..61dbeea317f3 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -36,7 +36,6 @@
#include <linux/gfp.h>
#include <linux/vmalloc.h>
#include <linux/highmem.h>
-#include <linux/hugetlb.h>
#include <linux/kvm_irqfd.h>
#include <linux/irqbypass.h>
#include <linux/module.h>
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 1/4] mm: move vma_kernel_pagesize() from hugetlb to mm.h
2026-03-06 10:15 ` [PATCH v1 1/4] mm: move vma_kernel_pagesize() from hugetlb to mm.h David Hildenbrand (Arm)
@ 2026-03-06 11:07 ` Lorenzo Stoakes (Oracle)
2026-03-06 13:25 ` David Hildenbrand (Arm)
0 siblings, 1 reply; 15+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-06 11:07 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: linux-kernel, linux-mm, linuxppc-dev, kvm, Dan Williams
On Fri, Mar 06, 2026 at 11:15:57AM +0100, David Hildenbrand (Arm) wrote:
> In the past, only hugetlb had special "vma_kernel_pagesize()"
> requirements, so it provided its own implementation.
>
> In commit 05ea88608d4e ("mm, hugetlbfs: introduce ->pagesize() to
> vm_operations_struct") we generalized that approach by providing a
> vm_ops->pagesize() callback to be used by device-dax.
>
> Once device-dax started using that callback in commit c1d53b92b95c
> ("device-dax: implement ->pagesize() for smaps to report MMUPageSize")
> it was missed that CONFIG_DEV_DAX does not depend on hugetlb support.
>
> So building a kernel with CONFIG_DEV_DAX but without CONFIG_HUGETLBFS
> would not pick up that value.
>
> Fix it by moving vma_kernel_pagesize() to mm.h, providing only a single
> implementation. While at it, improve the kerneldoc a bit.
>
> Ideally, we'd move vma_mmu_pagesize() as well to the header. However,
> its __weak symbol might be overwritten by a PPC variant in hugetlb code.
> So let's leave it in there for now, as it really only matters for some
> hugetlb oddities.
>
> This was found by code inspection.
>
> Fixes: c1d53b92b95c ("device-dax: implement ->pagesize() for smaps to report MMUPageSize")
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
LGTM, but you need to fix up VMA tests, I attach a patch below to do this. Will
this resolved:
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
> ---
> include/linux/hugetlb.h | 7 -------
> include/linux/mm.h | 20 ++++++++++++++++++++
> mm/hugetlb.c | 17 -----------------
> 3 files changed, 20 insertions(+), 24 deletions(-)
>
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 65910437be1c..44c1848a2c21 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -777,8 +777,6 @@ static inline unsigned long huge_page_size(const struct hstate *h)
> return (unsigned long)PAGE_SIZE << h->order;
> }
>
> -extern unsigned long vma_kernel_pagesize(struct vm_area_struct *vma);
> -
> extern unsigned long vma_mmu_pagesize(struct vm_area_struct *vma);
>
> static inline unsigned long huge_page_mask(struct hstate *h)
> @@ -1177,11 +1175,6 @@ static inline unsigned long huge_page_mask(struct hstate *h)
> return PAGE_MASK;
> }
>
> -static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
> -{
> - return PAGE_SIZE;
> -}
> -
> static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
> {
> return PAGE_SIZE;
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 44e04a42fe77..227809790f1a 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1307,6 +1307,26 @@ static inline bool vma_is_shared_maywrite(const struct vm_area_struct *vma)
> return is_shared_maywrite(&vma->flags);
> }
>
> +/**
> + * vma_kernel_pagesize - Default page size granularity for this VMA.
> + * @vma: The user mapping.
> + *
> + * The kernel page size specifies in which granularity VMA modifications
> + * can be performed. Folios in this VMA will be aligned to, and at least
> + * the size of the number of bytes returned by this function.
> + *
> + * The default kernel page size is not affected by Transparent Huge Pages
> + * being in effect.
> + *
> + * Return: The default page size granularity for this VMA.
> + */
> +static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
> +{
> + if (unlikely(vma->vm_ops && vma->vm_ops->pagesize))
> + return vma->vm_ops->pagesize(vma);
> + return PAGE_SIZE;
> +}
> +
> static inline
> struct vm_area_struct *vma_find(struct vma_iterator *vmi, unsigned long max)
> {
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 1d41fa3dd43e..66eadfa9e958 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1017,23 +1017,6 @@ static pgoff_t vma_hugecache_offset(struct hstate *h,
> (vma->vm_pgoff >> huge_page_order(h));
> }
>
> -/**
> - * vma_kernel_pagesize - Page size granularity for this VMA.
> - * @vma: The user mapping.
> - *
> - * Folios in this VMA will be aligned to, and at least the size of the
> - * number of bytes returned by this function.
> - *
> - * Return: The default size of the folios allocated when backing a VMA.
> - */
> -unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
> -{
> - if (vma->vm_ops && vma->vm_ops->pagesize)
> - return vma->vm_ops->pagesize(vma);
> - return PAGE_SIZE;
> -}
> -EXPORT_SYMBOL_GPL(vma_kernel_pagesize);
> -
> /*
> * 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
> --
> 2.43.0
>
----8<----
This breaks the VMA tests when patch 2/4 removes the references in other
headers. So this patch should also update them, I enclose a simple fix for
convenience:
From bec84895cbdbe28e3495c4d90e097074598419e5 Mon Sep 17 00:00:00 2001
From: "Lorenzo Stoakes (Oracle)" <ljs@kernel.org>
Date: Fri, 6 Mar 2026 11:05:12 +0000
Subject: [PATCH] fix
---
tools/testing/vma/include/dup.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h
index 3078ff1487d3..65b1030a7fdf 100644
--- a/tools/testing/vma/include/dup.h
+++ b/tools/testing/vma/include/dup.h
@@ -1318,3 +1318,10 @@ static inline void vma_set_file(struct vm_area_struct *vma, struct file *file)
swap(vma->vm_file, file);
fput(file);
}
+
+static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
+{
+ if (unlikely(vma->vm_ops && vma->vm_ops->pagesize))
+ return vma->vm_ops->pagesize(vma);
+ return PAGE_SIZE;
+}
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 2/4] mm: move vma_mmu_pagesize() from hugetlb to vma.c
2026-03-06 10:15 ` [PATCH v1 2/4] mm: move vma_mmu_pagesize() from hugetlb to vma.c David Hildenbrand (Arm)
@ 2026-03-06 11:11 ` Lorenzo Stoakes (Oracle)
0 siblings, 0 replies; 15+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-06 11:11 UTC (permalink / raw)
To: David Hildenbrand (Arm); +Cc: linux-kernel, linux-mm, linuxppc-dev, kvm
On Fri, Mar 06, 2026 at 11:15:58AM +0100, David Hildenbrand (Arm) wrote:
> 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.
>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
LGTM, so:
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
> ---
> include/linux/hugetlb.h | 7 -------
> include/linux/mm.h | 2 ++
> mm/hugetlb.c | 11 -----------
> mm/vma.c | 21 +++++++++++++++++++++
> 4 files changed, 23 insertions(+), 18 deletions(-)
>
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 44c1848a2c21..aaf3d472e6b5 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -777,8 +777,6 @@ static inline unsigned long huge_page_size(const struct hstate *h)
> 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_mask(struct hstate *h)
> 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;
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 227809790f1a..22d338933c84 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1327,6 +1327,8 @@ static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
> 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)
> {
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 66eadfa9e958..f6ecca9aae01 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1017,17 +1017,6 @@ static pgoff_t vma_hugecache_offset(struct hstate *h,
> (vma->vm_pgoff >> huge_page_order(h));
> }
>
> -/*
> - * 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
> diff --git a/mm/vma.c b/mm/vma.c
> index be64f781a3aa..e95fd5a5fe5c 100644
> --- a/mm/vma.c
> +++ b/mm/vma.c
> @@ -3300,3 +3300,24 @@ int insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma)
>
> 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);
> +}
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 3/4] KVM: remove hugetlb.h inclusion
2026-03-06 10:15 ` [PATCH v1 3/4] KVM: remove hugetlb.h inclusion David Hildenbrand (Arm)
@ 2026-03-06 11:11 ` Lorenzo Stoakes (Oracle)
2026-03-06 13:27 ` David Hildenbrand (Arm)
0 siblings, 1 reply; 15+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-06 11:11 UTC (permalink / raw)
To: David Hildenbrand (Arm); +Cc: linux-kernel, linux-mm, linuxppc-dev, kvm
On Fri, Mar 06, 2026 at 11:15:59AM +0100, David Hildenbrand (Arm) wrote:
> hugetlb.h is no longer required now that we moved vma_kernel_pagesize()
> to mm.h.
>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Aww this is the tiniest cutest patch evah!
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
> ---
> virt/kvm/kvm_main.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 22f8a672e1fd..58059648b881 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -41,7 +41,6 @@
> #include <linux/spinlock.h>
> #include <linux/compat.h>
> #include <linux/srcu.h>
> -#include <linux/hugetlb.h>
> #include <linux/slab.h>
> #include <linux/sort.h>
> #include <linux/bsearch.h>
> --
> 2.43.0
>
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 4/4] KVM: PPC: remove hugetlb.h inclusion
2026-03-06 10:16 ` [PATCH v1 4/4] KVM: PPC: " David Hildenbrand (Arm)
@ 2026-03-06 11:12 ` Lorenzo Stoakes (Oracle)
0 siblings, 0 replies; 15+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-06 11:12 UTC (permalink / raw)
To: David Hildenbrand (Arm); +Cc: linux-kernel, linux-mm, linuxppc-dev, kvm
On Fri, Mar 06, 2026 at 11:16:00AM +0100, David Hildenbrand (Arm) wrote:
> hugetlb.h is no longer required now that we moved vma_kernel_pagesize()
> to mm.h.
>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
You've gone mega cute on this one too! <3
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
> ---
> arch/powerpc/kvm/book3s_hv.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 08e5816fdd61..61dbeea317f3 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -36,7 +36,6 @@
> #include <linux/gfp.h>
> #include <linux/vmalloc.h>
> #include <linux/highmem.h>
> -#include <linux/hugetlb.h>
> #include <linux/kvm_irqfd.h>
> #include <linux/irqbypass.h>
> #include <linux/module.h>
> --
> 2.43.0
>
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c
2026-03-06 10:15 [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c David Hildenbrand (Arm)
` (3 preceding siblings ...)
2026-03-06 10:16 ` [PATCH v1 4/4] KVM: PPC: " David Hildenbrand (Arm)
@ 2026-03-06 11:13 ` Pedro Falcato
2026-03-06 11:19 ` Lorenzo Stoakes (Oracle)
2026-03-06 15:30 ` Mike Rapoport
5 siblings, 1 reply; 15+ messages in thread
From: Pedro Falcato @ 2026-03-06 11:13 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: linux-kernel, linux-mm, linuxppc-dev, kvm, Andrew Morton,
Madhavan Srinivasan, Nicholas Piggin, Michael Ellerman,
Christophe Leroy (CS GROUP),
Muchun Song, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jann Horn, Paolo Bonzini, Dan Williams
On Fri, Mar 06, 2026 at 11:15:56AM +0100, David Hildenbrand (Arm) wrote:
> Looking into vma_(kernel|mmu)_pagesize(), I realized that there is one
> scenario where DAX would not do the right thing when the kernel is
> not compiled with hugetlb support.
>
> Without hugetlb support, vma_(kernel|mmu)_pagesize() will always return
> PAGE_SIZE instead of using the ->pagesize() result provided by dax-device
> code.
>
> Fix that by moving vma_kernel_pagesize() to core MM code, where it belongs.
> I don't think this is stable material, but am not 100% sure.
>
> Also, move vma_mmu_pagesize() while at it. Remove the unnecessary hugetlb.h
> inclusion from KVM code.
>
> Cross-compiled heavily.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
> Cc: Muchun Song <muchun.song@linux.dev>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Lorenzo Stoakes <ljs@kernel.org>
> Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
> Cc: Vlastimil Babka <vbabka@kernel.org>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Suren Baghdasaryan <surenb@google.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Jann Horn <jannh@google.com>
> Cc: Pedro Falcato <pfalcato@suse.de>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
Although we all love less mail, FYI it seems like this didn't work properly
for the patches (no CC's on there).
Did you try git-email --cc-cover?
--
Pedro
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c
2026-03-06 11:13 ` [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c Pedro Falcato
@ 2026-03-06 11:19 ` Lorenzo Stoakes (Oracle)
2026-03-06 13:12 ` David Hildenbrand (Arm)
0 siblings, 1 reply; 15+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-06 11:19 UTC (permalink / raw)
To: Pedro Falcato
Cc: David Hildenbrand (Arm),
linux-kernel, linux-mm, linuxppc-dev, kvm, Andrew Morton,
Madhavan Srinivasan, Nicholas Piggin, Michael Ellerman,
Christophe Leroy (CS GROUP),
Muchun Song, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jann Horn,
Paolo Bonzini, Dan Williams
On Fri, Mar 06, 2026 at 11:13:41AM +0000, Pedro Falcato wrote:
> On Fri, Mar 06, 2026 at 11:15:56AM +0100, David Hildenbrand (Arm) wrote:
> > Looking into vma_(kernel|mmu)_pagesize(), I realized that there is one
> > scenario where DAX would not do the right thing when the kernel is
> > not compiled with hugetlb support.
> >
> > Without hugetlb support, vma_(kernel|mmu)_pagesize() will always return
> > PAGE_SIZE instead of using the ->pagesize() result provided by dax-device
> > code.
> >
> > Fix that by moving vma_kernel_pagesize() to core MM code, where it belongs.
> > I don't think this is stable material, but am not 100% sure.
> >
> > Also, move vma_mmu_pagesize() while at it. Remove the unnecessary hugetlb.h
> > inclusion from KVM code.
> >
> > Cross-compiled heavily.
> >
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
> > Cc: Nicholas Piggin <npiggin@gmail.com>
> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> > Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
> > Cc: Muchun Song <muchun.song@linux.dev>
> > Cc: Oscar Salvador <osalvador@suse.de>
> > Cc: Lorenzo Stoakes <ljs@kernel.org>
> > Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
> > Cc: Vlastimil Babka <vbabka@kernel.org>
> > Cc: Mike Rapoport <rppt@kernel.org>
> > Cc: Suren Baghdasaryan <surenb@google.com>
> > Cc: Michal Hocko <mhocko@suse.com>
> > Cc: Jann Horn <jannh@google.com>
> > Cc: Pedro Falcato <pfalcato@suse.de>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
>
> Although we all love less mail, FYI it seems like this didn't work properly
> for the patches (no CC's on there).
>
> Did you try git-email --cc-cover?
Yeah I noticed this also :>) Assumed it was a new way of doing things somehow?
:P
>
> --
> Pedro
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c
2026-03-06 11:19 ` Lorenzo Stoakes (Oracle)
@ 2026-03-06 13:12 ` David Hildenbrand (Arm)
0 siblings, 0 replies; 15+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-06 13:12 UTC (permalink / raw)
To: Lorenzo Stoakes (Oracle), Pedro Falcato
Cc: linux-kernel, linux-mm, linuxppc-dev, kvm, Andrew Morton,
Madhavan Srinivasan, Nicholas Piggin, Michael Ellerman,
Christophe Leroy (CS GROUP),
Muchun Song, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jann Horn,
Paolo Bonzini, Dan Williams
On 3/6/26 12:19, Lorenzo Stoakes (Oracle) wrote:
> On Fri, Mar 06, 2026 at 11:13:41AM +0000, Pedro Falcato wrote:
>> On Fri, Mar 06, 2026 at 11:15:56AM +0100, David Hildenbrand (Arm) wrote:
>>> Looking into vma_(kernel|mmu)_pagesize(), I realized that there is one
>>> scenario where DAX would not do the right thing when the kernel is
>>> not compiled with hugetlb support.
>>>
>>> Without hugetlb support, vma_(kernel|mmu)_pagesize() will always return
>>> PAGE_SIZE instead of using the ->pagesize() result provided by dax-device
>>> code.
>>>
>>> Fix that by moving vma_kernel_pagesize() to core MM code, where it belongs.
>>> I don't think this is stable material, but am not 100% sure.
>>>
>>> Also, move vma_mmu_pagesize() while at it. Remove the unnecessary hugetlb.h
>>> inclusion from KVM code.
>>>
>>> Cross-compiled heavily.
>>>
>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>> Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
>>> Cc: Nicholas Piggin <npiggin@gmail.com>
>>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>>> Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
>>> Cc: Muchun Song <muchun.song@linux.dev>
>>> Cc: Oscar Salvador <osalvador@suse.de>
>>> Cc: Lorenzo Stoakes <ljs@kernel.org>
>>> Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
>>> Cc: Vlastimil Babka <vbabka@kernel.org>
>>> Cc: Mike Rapoport <rppt@kernel.org>
>>> Cc: Suren Baghdasaryan <surenb@google.com>
>>> Cc: Michal Hocko <mhocko@suse.com>
>>> Cc: Jann Horn <jannh@google.com>
>>> Cc: Pedro Falcato <pfalcato@suse.de>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Cc: Dan Williams <dan.j.williams@intel.com>
>>
>> Although we all love less mail, FYI it seems like this didn't work properly
>> for the patches (no CC's on there).
>>
>> Did you try git-email --cc-cover?
>
> Yeah I noticed this also :>) Assumed it was a new way of doing things somehow?
> :P
"--cc-cover" is apparently not the git default on my new machine.
"See, I CCed you, I totally did not try to sneak something in. Oh, I
messed up my tooling, stupid me ...". :)
--
Cheers,
David
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 1/4] mm: move vma_kernel_pagesize() from hugetlb to mm.h
2026-03-06 11:07 ` Lorenzo Stoakes (Oracle)
@ 2026-03-06 13:25 ` David Hildenbrand (Arm)
0 siblings, 0 replies; 15+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-06 13:25 UTC (permalink / raw)
To: Lorenzo Stoakes (Oracle)
Cc: linux-kernel, linux-mm, linuxppc-dev, kvm, Dan Williams
On 3/6/26 12:07, Lorenzo Stoakes (Oracle) wrote:
> On Fri, Mar 06, 2026 at 11:15:57AM +0100, David Hildenbrand (Arm) wrote:
>> In the past, only hugetlb had special "vma_kernel_pagesize()"
>> requirements, so it provided its own implementation.
>>
>> In commit 05ea88608d4e ("mm, hugetlbfs: introduce ->pagesize() to
>> vm_operations_struct") we generalized that approach by providing a
>> vm_ops->pagesize() callback to be used by device-dax.
>>
>> Once device-dax started using that callback in commit c1d53b92b95c
>> ("device-dax: implement ->pagesize() for smaps to report MMUPageSize")
>> it was missed that CONFIG_DEV_DAX does not depend on hugetlb support.
>>
>> So building a kernel with CONFIG_DEV_DAX but without CONFIG_HUGETLBFS
>> would not pick up that value.
>>
>> Fix it by moving vma_kernel_pagesize() to mm.h, providing only a single
>> implementation. While at it, improve the kerneldoc a bit.
>>
>> Ideally, we'd move vma_mmu_pagesize() as well to the header. However,
>> its __weak symbol might be overwritten by a PPC variant in hugetlb code.
>> So let's leave it in there for now, as it really only matters for some
>> hugetlb oddities.
>>
>> This was found by code inspection.
>>
>> Fixes: c1d53b92b95c ("device-dax: implement ->pagesize() for smaps to report MMUPageSize")
>> Cc: Dan Williams <dan.j.williams@intel.com>
>> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
>
> LGTM, but you need to fix up VMA tests, I attach a patch below to do this. Will
> this resolved:
Thanks!
I assume that should go into patch #2 instead?
>
> Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
[...]
> ---
> tools/testing/vma/include/dup.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h
> index 3078ff1487d3..65b1030a7fdf 100644
> --- a/tools/testing/vma/include/dup.h
> +++ b/tools/testing/vma/include/dup.h
> @@ -1318,3 +1318,10 @@ static inline void vma_set_file(struct vm_area_struct *vma, struct file *file)
> swap(vma->vm_file, file);
> fput(file);
> }
> +
> +static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
> +{
> + if (unlikely(vma->vm_ops && vma->vm_ops->pagesize))
> + return vma->vm_ops->pagesize(vma);
> + return PAGE_SIZE;
Should we just KIS and use PAGE_SIZE for the test?
--
Cheers,
David
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 3/4] KVM: remove hugetlb.h inclusion
2026-03-06 11:11 ` Lorenzo Stoakes (Oracle)
@ 2026-03-06 13:27 ` David Hildenbrand (Arm)
0 siblings, 0 replies; 15+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-06 13:27 UTC (permalink / raw)
To: Lorenzo Stoakes (Oracle); +Cc: linux-kernel, linux-mm, linuxppc-dev, kvm
On 3/6/26 12:11, Lorenzo Stoakes (Oracle) wrote:
> On Fri, Mar 06, 2026 at 11:15:59AM +0100, David Hildenbrand (Arm) wrote:
>> hugetlb.h is no longer required now that we moved vma_kernel_pagesize()
>> to mm.h.
>>
>> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
>
> Aww this is the tiniest cutest patch evah!
It's a very smol patch! :)
--
Cheers,
David
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c
2026-03-06 10:15 [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c David Hildenbrand (Arm)
` (4 preceding siblings ...)
2026-03-06 11:13 ` [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c Pedro Falcato
@ 2026-03-06 15:30 ` Mike Rapoport
5 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport @ 2026-03-06 15:30 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: linux-kernel, linux-mm, linuxppc-dev, kvm, Andrew Morton,
Madhavan Srinivasan, Nicholas Piggin, Michael Ellerman,
Christophe Leroy (CS GROUP),
Muchun Song, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Suren Baghdasaryan, Michal Hocko, Jann Horn,
Pedro Falcato, Paolo Bonzini, Dan Williams
On Fri, Mar 06, 2026 at 11:15:56AM +0100, David Hildenbrand (Arm) wrote:
> Looking into vma_(kernel|mmu)_pagesize(), I realized that there is one
> scenario where DAX would not do the right thing when the kernel is
> not compiled with hugetlb support.
>
> Without hugetlb support, vma_(kernel|mmu)_pagesize() will always return
> PAGE_SIZE instead of using the ->pagesize() result provided by dax-device
> code.
>
> Fix that by moving vma_kernel_pagesize() to core MM code, where it belongs.
> I don't think this is stable material, but am not 100% sure.
>
> Also, move vma_mmu_pagesize() while at it. Remove the unnecessary hugetlb.h
> inclusion from KVM code.
>
> Cross-compiled heavily.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
> Cc: Muchun Song <muchun.song@linux.dev>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Lorenzo Stoakes <ljs@kernel.org>
> Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
> Cc: Vlastimil Babka <vbabka@kernel.org>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Suren Baghdasaryan <surenb@google.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Jann Horn <jannh@google.com>
> Cc: Pedro Falcato <pfalcato@suse.de>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
>
> David Hildenbrand (Arm) (4):
> mm: move vma_kernel_pagesize() from hugetlb to mm.h
> mm: move vma_mmu_pagesize() from hugetlb to vma.c
> KVM: remove hugetlb.h inclusion
> KVM: PPC: remove hugetlb.h inclusion
>
> arch/powerpc/kvm/book3s_hv.c | 1 -
> include/linux/hugetlb.h | 14 --------------
> include/linux/mm.h | 22 ++++++++++++++++++++++
> mm/hugetlb.c | 28 ----------------------------
> mm/vma.c | 21 +++++++++++++++++++++
> virt/kvm/kvm_main.c | 1 -
> 6 files changed, 43 insertions(+), 44 deletions(-)
For the series:
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> base-commit: f75825cdfc4c5477cffcfd2cafa4e5ce5aa67f13
> --
> 2.43.0
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-03-06 15:31 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-06 10:15 [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c David Hildenbrand (Arm)
2026-03-06 10:15 ` [PATCH v1 1/4] mm: move vma_kernel_pagesize() from hugetlb to mm.h David Hildenbrand (Arm)
2026-03-06 11:07 ` Lorenzo Stoakes (Oracle)
2026-03-06 13:25 ` David Hildenbrand (Arm)
2026-03-06 10:15 ` [PATCH v1 2/4] mm: move vma_mmu_pagesize() from hugetlb to vma.c David Hildenbrand (Arm)
2026-03-06 11:11 ` Lorenzo Stoakes (Oracle)
2026-03-06 10:15 ` [PATCH v1 3/4] KVM: remove hugetlb.h inclusion David Hildenbrand (Arm)
2026-03-06 11:11 ` Lorenzo Stoakes (Oracle)
2026-03-06 13:27 ` David Hildenbrand (Arm)
2026-03-06 10:16 ` [PATCH v1 4/4] KVM: PPC: " David Hildenbrand (Arm)
2026-03-06 11:12 ` Lorenzo Stoakes (Oracle)
2026-03-06 11:13 ` [PATCH v1 0/4] mm: move vma_(kernel|mmu)_pagesize() out of hugetlb.c Pedro Falcato
2026-03-06 11:19 ` Lorenzo Stoakes (Oracle)
2026-03-06 13:12 ` David Hildenbrand (Arm)
2026-03-06 15:30 ` Mike Rapoport
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox