Re: [PATCH v3 13/13] mm/huge_memory: add and use has_deposited_pgtable()

Yin Tirui
2026-04-02T03:19:18Z

On 3/21/26 02:07, Lorenzo Stoakes (Oracle) wrote:

> +static bool has_deposited_pgtable(struct vm_area_struct *vma, pmd_t pmdval,
> + struct folio *folio)
> +{
> + /* Some architectures require unconditional depositing. */
> + if (arch_needs_pgtable_deposit())
> + return true;
> +
> + /*
> + * Huge zero always deposited except for DAX which handles itself, see
> + * set_huge_zero_folio().
> + */
> + if (is_huge_zero_pmd(pmdval))
> + return !vma_is_dax(vma);
> +
> + /*
> + * Otherwise, only anonymous folios are deposited, see
> + * __do_huge_pmd_anonymous_page().
> + */
> + return folio && folio_test_anon(folio);
> +}

Hi Lorenzo,

I just wanted to mention a potential intersection with my upcoming v4 of
the "mm: add huge pfnmap support for remap_pfn_range()" series [1].

To safely support PMD splitting on partial unmaps, my series makes
VM_PFNMAP huge pages allocate and deposit page tables. However, they
neither have an underlying struct folio nor are anonymous.

Given the has_deposited_pgtable() helper, do you have any suggestions on
what would be the cleanest way to integrate the VM_PFNMAP condition into it?

[1]
https://lore.kernel.org/linux-mm/20260228070906.1418911-5-yintirui@huawei.com/

--
Yin Tirui