Re: [RESEND PATCH v7 04/10] mm: thp: Support allocation of anonymous small-sized THP

From: Barry Song
Date: Sun Nov 26 2023 - 22:42:00 EST


> + if ((nr_pages == 1 && vmf_pte_changed(vmf)) ||
> + (nr_pages > 1 && !pte_range_none(vmf->pte, nr_pages))) {
> + for (i = 0; i < nr_pages; i++)
> + update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pte + i);
> goto release;
> }

Hi Ryan,
what has stopped nr_pages == 1 from using !pte_range_none(vmf->pte, 1)
directly, then the code can become,
+ if (!pte_range_none(vmf->pte, nr_pages)) {
+ for (i = 0; i < nr_pages; i++)
+ update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pte + i);
goto release;
}

for both 1 and > 1 cases?

Thanks
Barry