Re: [PATCH v3 04/10] drivers: nvdimm: use pgtable_has_pmd_leaves()
From: Luiz Capitulino
Date: Thu Apr 09 2026 - 14:51:34 EST
On 2026-04-09 11:21, Zi Yan wrote:
On 8 Apr 2026, at 16:22, 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.
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()) {
alignments[1] = HPAGE_PMD_SIZE;
if (has_transparent_pud_hugepage())
Hmm, there is also has_transparent_pud_hugepage(). Should it be converted
to pgtable_has_pud_leavs() like has_transparent_hugepage()?
Feel free to defer it to a future patchset.
Yes, I plan to tackle that next once this one is merged.
(Thanks for the reviews, btw).
Acked-by: Zi Yan <ziy@xxxxxxxxxx>
alignments[2] = HPAGE_PUD_SIZE;
@@ -109,7 +110,8 @@ static unsigned long *nd_pfn_supported_alignments(unsigned long *alignments)
static unsigned long nd_pfn_default_alignment(void)
{
- if (has_transparent_hugepage())
+ if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) &&
+ pgtable_has_pmd_leaves())
return HPAGE_PMD_SIZE;
return PAGE_SIZE;
}
--
2.53.0
Best Regards,
Yan, Zi