Re: [PATCH v2 1/3] mm/huge_memory: Fix use of NULL folio in move_pages_huge_pmd()

From: Lorenzo Stoakes

Date: Mon Mar 02 2026 - 12:38:06 EST


On Mon, Mar 02, 2026 at 05:23:30PM +0000, Lorenzo Stoakes wrote:
> > diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> > index 44ff8a648afd..fed57951a7cd 100644
> > --- a/mm/huge_memory.c
> > +++ b/mm/huge_memory.c
> > @@ -2794,7 +2794,7 @@ int move_pages_huge_pmd(struct mm_struct *mm, pmd_t *dst_pmd, pmd_t *src_pmd, pm
> > _dst_pmd = pmd_mkwrite(pmd_mkdirty(_dst_pmd), dst_vma);
> > } else {
> > src_pmdval = pmdp_huge_clear_flush(src_vma, src_addr, src_pmd);
> > - _dst_pmd = folio_mk_pmd(src_folio, dst_vma->vm_page_prot);
> > + _dst_pmd = folio_mk_pmd(page_folio(src_page), dst_vma->vm_page_prot);
>
> I prefer my version at [0].
>
> Cleaner to actually pull out the zero_folio into a local variable, and also we
> should mark it special to be consistent with other codepaths.
>
> [0]:https://lore.kernel.org/all/20260302170619.867056-1-lorenzo.stoakes@xxxxxxxxxx/

OK ignore me, I saw David's comment and agree with him, as I said to you in the
2/3, let's just take that as the patch and mark that fixes e3981db444a0.

Assuming you agree David?

Thanks, Lorenzo