Re: [PATCH v8 05/14] drivers: nvdimm: use pgtable_has_pmd_leaves()

From: David Hildenbrand (Arm)

Date: Fri Oct 02 2026 - 15:18:37 EST


On 9/18/26 03:45, Luiz Capitulino wrote:
> nd_pfn_supported_alignments() and nd_pfn_default_alignment() use
> has_transparent_hugepage() to check if THP is supported with PMD-sized
> pages. Use pgtable_has_pmd_leaves() instead. Also, check for
> IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) to preserve the current
> implementation semantics.
>
> Acked-by: Zi Yan <ziy@xxxxxxxxxx>
> Signed-off-by: Luiz Capitulino <luizcap@xxxxxxxxxx>
> ---
> drivers/nvdimm/pfn_devs.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
> index 8fa9c16aba7e..457eb54e7ab6 100644
> --- a/drivers/nvdimm/pfn_devs.c
> +++ b/drivers/nvdimm/pfn_devs.c
> @@ -94,7 +94,8 @@ static unsigned long *nd_pfn_supported_alignments(unsigned long *alignments)
>
> alignments[0] = PAGE_SIZE;
>
> - if (has_transparent_hugepage()) {
> + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) &&
> + pgtable_has_pmd_leaves()) {

Not sure if I mentioned it but we *could* provide a helper that checks for THP
PMD order support. But I would only add that if really used frequently.

Scanning your other patches, that doesn't seem to be the case :)

Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David