Re: [PATCH v2 7/9] mm/huge_memory: deduplicate zap deposited table call
From: Kiryl Shutsemau
Date: Thu Mar 19 2026 - 17:57:13 EST
On Thu, Mar 19, 2026 at 05:18:11PM +0000, Lorenzo Stoakes (Oracle) wrote:
> On Thu, Mar 19, 2026 at 05:03:10PM +0000, Kiryl Shutsemau wrote:
> > On Thu, Mar 19, 2026 at 01:00:13PM +0000, Lorenzo Stoakes (Oracle) wrote:
> > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> > > index 499c31bf8f83..c4e00c645e58 100644
> > > --- a/mm/huge_memory.c
> > > +++ b/mm/huge_memory.c
> > > @@ -2431,6 +2431,7 @@ bool zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
> > > pmd_t *pmd, unsigned long addr)
> > > {
> > > struct folio *folio = NULL;
> > > + bool needs_deposit = false;
> >
> > I think 'has_deposit' is a better name here.
>
> That's fine, can rename.
>
> >
> > And initialize it to arch_needs_pgtable_deposit().
>
> Yeah I considered that, but then you have to do logic like:
>
> has_deposit = has_deposit || <whatever>;
>
> Which is a bit ugly.
You are overthinking it. Just do
if (!vma_is_dax(vma))
has_deposit = true;
No need in squeezing it into single line.
--
Kiryl Shutsemau / Kirill A. Shutemov