Re: [PATCH v2 7/9] mm/huge_memory: deduplicate zap deposited table call

Lorenzo Stoakes (Oracle)
2026-03-20T14:00:07Z

On Thu, Mar 19, 2026 at 09:56:53PM +0000, Kiryl Shutsemau wrote:
> 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

Well I would argue you're overthinking the review comments here ;)

>
> if (!vma_is_dax(vma))
> has_deposit = true;
>
> No need in squeezing it into single line.

Well part of the point here was to avoid ugly:

Indent
Indent
Indent

And that worsens the situation.

Let me think about this again on respin.

>
> --
> Kiryl Shutsemau / Kirill A. Shutemov

Thanks, Lorenzo