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

Lorenzo Stoakes (Oracle)
2026-03-19T17:18:21Z

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.

Could do

has_deposit |= <whatever>

But then that's weird with bools.

Could be has_non_arch_deposit but that's too long and... yeah :>)

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

Cheers, Lorenzo