Re: [PATCH 01/13] mm: add softleaf_to_pmd() and convert existing callers
From: David Hildenbrand (Arm)
Date: Wed May 13 2026 - 15:24:37 EST
On 4/27/26 12:01, Usama Arif wrote:
> Add softleaf_to_pmd() as the PMD counterpart to softleaf_to_pte(),
> completing the symmetry of the softleaf abstraction for page table
> leaf entries.
>
> The upcoming PMD swap entry support needs to construct PMD entries
> from swap entries. Converting existing swp_entry_to_pmd() callers
> to softleaf_to_pmd() in a prep patch keeps the feature patches
> focused on new functionality rather than mixing refactoring with
> new code.
>
> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
> ---
> include/linux/leafops.h | 20 ++++++++++++++++++++
> mm/huge_memory.c | 12 ++++++------
> 2 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/leafops.h b/include/linux/leafops.h
> index 992cd8bd8ed0..803d312437df 100644
> --- a/include/linux/leafops.h
> +++ b/include/linux/leafops.h
> @@ -108,6 +108,21 @@ static inline softleaf_t softleaf_from_pmd(pmd_t pmd)
> return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry));
> }
>
> +/**
> + * softleaf_to_pmd() - Obtain a PMD entry from a leaf entry.
> + * @entry: Leaf entry.
> + *
> + * This generates an architecture-specific PMD entry that can be utilised to
> + * encode the metadata the leaf entry encodes.
> + *
> + * Returns: Architecture-specific PMD entry encoding leaf entry.
> + */
> +static inline pmd_t softleaf_to_pmd(softleaf_t entry)
> +{
> + /* Temporary until swp_entry_t eliminated. */
> + return swp_entry_to_pmd(entry);
> +}
> +
Yeah, just what we do for ptes.
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David