[PATCH 5/6] mm/mremap: Use pmd/pud_poplulate to update page table entries

Linus Torvalds torvalds at linux-foundation.org
Fri Jun 11 04:16:12 AEST 2021


On Thu, Jun 10, 2021 at 1:36 AM Aneesh Kumar K.V
<aneesh.kumar at linux.ibm.com> wrote:
>
> @@ -306,8 +306,7 @@ static bool move_normal_pud(struct vm_area_struct *vma, unsigned long old_addr,
>
>         VM_BUG_ON(!pud_none(*new_pud));
>
> -       /* Set the new pud */
> -       set_pud_at(mm, new_addr, new_pud, pud);
> +       pud_populate(mm, new_pud, (pmd_t *)pud_page_vaddr(pud));
>         flush_tlb_range(vma, old_addr, old_addr + PUD_SIZE);
>         if (new_ptl != old_ptl)
>                 spin_unlock(new_ptl);

That "(pmd_t *)pud_page_vaddr(pud)" looks a bit odd and doesn't match
the pattern.

Should we perhaps have a wrapper for it? Maybe called "pud_pgtable()",
the same way we have pmd_pgtable()?

And that wrapper would be good to have a comment or two about what it
actually is. The same way that pmd_pgtable() should but doesn't ;(

            Linus


More information about the Linuxppc-dev mailing list