Re: [PATCH 2/9] mm: make hw_pte_t visible to generic PTE interfaces
From: Anshuman Khandual
Date: Tue Aug 11 2026 - 06:21:53 EST
On Thu, Aug 06, 2026 at 09:38:40AM +0100, Muhammad Usama Anjum wrote:
> Later conversions use hw_pte_t in page-table checking, generic page-table
> helpers, and vmalloc interfaces. Include linux/pgtable_types.h from the
> headers that declare those interfaces before changing their types.
>
> For vmalloc.h, replace the direct asm/page.h include with
> linux/pgtable_types.h. The latter includes asm/page.h, so pgprot_t remains
> available. It also provides either the default alias or the opted-in
> hw_pte_t wrapper.
Stand-alone header file updates are not ideal. Why cannot these changes be
folded in, where hw_pte_t gets used first time ever in the above mentioned
places.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
> ---
> Changes since RFC v1:
> - Clarify that the header provides both generic hw_pte_t definitions.
> ---
> include/linux/page_table_check.h | 2 ++
> include/linux/pgtable.h | 1 +
> include/linux/vmalloc.h | 2 +-
> 3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/page_table_check.h b/include/linux/page_table_check.h
> index 12268a32e8be1..12ee6d16ad339 100644
> --- a/include/linux/page_table_check.h
> +++ b/include/linux/page_table_check.h
> @@ -7,6 +7,8 @@
> #ifndef __LINUX_PAGE_TABLE_CHECK_H
> #define __LINUX_PAGE_TABLE_CHECK_H
>
> +#include <linux/pgtable_types.h>
> +
> #ifdef CONFIG_PAGE_TABLE_CHECK
> #include <linux/jump_label.h>
>
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index 8c093c119e5a8..cf595608cc4c4 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -4,6 +4,7 @@
>
> #include <linux/pfn.h>
> #include <asm/pgtable.h>
> +#include <linux/pgtable_types.h>
>
> #define PMD_ORDER (PMD_SHIFT - PAGE_SHIFT)
> #define PUD_ORDER (PUD_SHIFT - PAGE_SHIFT)
> diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
> index aed121d729b01..b068e6ade4207 100644
> --- a/include/linux/vmalloc.h
> +++ b/include/linux/vmalloc.h
> @@ -8,7 +8,7 @@
> #include <linux/init.h>
> #include <linux/list.h>
> #include <linux/llist.h>
> -#include <asm/page.h> /* pgprot_t */
> +#include <linux/pgtable_types.h> /* pgprot_t, hw_pte_t */
> #include <linux/rbtree.h>
> #include <linux/overflow.h>
>
> --
> 2.47.3
>