Re: [PATCH RFC 01/11] mm: introduce hw_pte_t for PTE table storage

Anshuman Khandual <[email protected]>
Newsgroups org.kernel.vger.bpf,dev.linux.lists.damon,org.freedesktop.lists.dri-devel,org.freedesktop.lists.intel-gfx,org.kernel.vger.linux-arch,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-parisc,org.kernel.vger.linux-perf-users,org.kernel.vger.linux-trace-kernel,org.kvack.linux-mm,org.xenproject.lists.xen-devel
Message-ID <6xah74eadjmo2bozyr62wcxo4hhpsiufx2mshh7tztyy2dzzps@63m327m7pl5u>
On Mon, Jul 27, 2026 at 05:46:52PM +0100, Muhammad Usama Anjum wrote:
> pte_t is used both for logical PTE values and for entries stored in a PTE
> table, so pte_t * does not distinguish a pointer to a copied value from a
> pointer to table storage.

Should we rather call them as "Linux PTE" and "HW PTE" instead ?

Some like "Logical PTE" does not really sound very clear on what it represents.

> 
> Introduce hw_pte_t as the generic name for a PTE table element. Define it
> as an alias of pte_t by default so architectures retain their existing
> representation and behavior until they opt in to a distinct storage type.

Makes sense.

> 
> Include asm/page.h so pte_t is defined before the generic alias.
> 
> Signed-off-by: Muhammad Usama Anjum <[email protected]>
> ---
>  MAINTAINERS                   |  1 +
>  include/linux/pgtable_types.h | 11 +++++++++++
>  2 files changed, 12 insertions(+)
>  create mode 100644 include/linux/pgtable_types.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 15dd00c7ffec5..78aac05949829 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -16981,6 +16981,7 @@ F:	include/linux/mmu_notifier.h
>  F:	include/linux/pagewalk.h
>  F:	include/linux/pgalloc.h
>  F:	include/linux/pgtable.h
> +F:	include/linux/pgtable_types.h

s/pgtable_types.h/pgtable_hw_types.h ?

>  F:	include/linux/ptdump.h
>  F:	include/linux/vmpressure.h
>  F:	include/linux/vmstat.h
> diff --git a/include/linux/pgtable_types.h b/include/linux/pgtable_types.h
> new file mode 100644
> index 0000000000000..ed5dba42a4f8c
> --- /dev/null
> +++ b/include/linux/pgtable_types.h
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_PGTABLE_TYPES_H
> +#define _LINUX_PGTABLE_TYPES_H
> +
> +#include <asm/page.h>
> +
> +#ifndef __HAVE_ARCH_HW_PTE_T

__HAVE_ARCH_HW_PTE_T macro is a better approach here or a config ARCH_HAS_HW_PTE_T
based selective platform subscription should be introduced instead ?

> +#define hw_pte_t pte_t
> +#endif
> +
> +#endif /* _LINUX_PGTABLE_TYPES_H */
> -- 
> 2.47.3
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.