On Mon, Apr 22, 2024 at 11:12:16AM -0700, Jianfeng Wang wrote: > Change __do_huge_pmd_anonymous_page() to take folio as input, as its > caller has used folio. Save one unnecessary call to compound_head(). I don't like this patch. It makes the assumption that folios will never be larger than PMD size, and I don't think that's an assumption that's going to last another five years. Look where you had to do &folio->page: > + clear_huge_page(&folio->page, vmf->address, HPAGE_PMD_NR); > + entry = mk_huge_pmd(&folio->page, vma->vm_page_prot); For mk_huge_pmd() in particular, you need to know the precise page, and not just use the first page of the folio.