[PATCH 2/7] mm: Introduce a common definition of mk_pte()
Alexander Gordeev
agordeev at linux.ibm.com
Wed Feb 19 01:07:36 PST 2025
On Mon, Feb 17, 2025 at 07:08:29PM +0000, Matthew Wilcox (Oracle) wrote:
> Most architectures simply call pfn_pte(). Centralise that as the normal
> definition and remove the definition of mk_pte() from the architectures
> which have either that exact definition or something similar.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy at infradead.org>
> ---
...
> arch/s390/include/asm/pgtable.h | 5 -----
...
> include/linux/mm.h | 9 +++++++++
> 22 files changed, 10 insertions(+), 99 deletions(-)
>
...
> diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
> index 3ee495b5171e..db932beabc87 100644
> --- a/arch/s390/include/asm/pgtable.h
> +++ b/arch/s390/include/asm/pgtable.h
> @@ -1449,11 +1449,6 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
> return pte_mkyoung(__pte);
> }
>
> -static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
> -{
> - return mk_pte_phys(page_to_phys(page), pgprot);
> -}
> -
> #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
> #define p4d_index(address) (((address) >> P4D_SHIFT) & (PTRS_PER_P4D-1))
> #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
...
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 7b1068ddcbb7..3ef11ff3922f 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1916,6 +1916,15 @@ static inline struct folio *pfn_folio(unsigned long pfn)
> return page_folio(pfn_to_page(pfn));
> }
>
> +#ifndef mk_pte
> +#ifdef CONFIG_MMU
> +static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
> +{
> + return pfn_pte(page_to_pfn(page), pgprot);
> +}
> +#endif
> +#endif
> +
> /**
> * folio_maybe_dma_pinned - Report if a folio may be pinned for DMA.
> * @folio: The folio.
For s390:
Reviewed-by: Alexander Gordeev <agordeev at linux.ibm.com>
Thanks!
More information about the linux-um
mailing list