v1
2026-08-03
follow_page_mask批量返回连续页 · v1
重构 follow_page_mask 系列为一次返回多页:新增 follow_pte_batch/gup_fill_pages,去掉 page_mask 并优化大 folio 解锁后填充。
原始补丁链接
子 Patch(5)
1/5
mm/gup: convert follow_page_mask() to return a long
[mm/gup: convert follow_page_mask() to return a long] follow_page_mask() and its helpers return a struct page pointer: NULL, ERR_PTR(), or the page found. Change the return type to long instead: 0, a
2/5
mm/gup: split follow_page_pte_commit() out of follow_page_pte()
[mm/gup: split follow_page_pte_commit() out of follow_page_pte()] follow_page_pte() does two things once it has resolved a present PTE to a page: run the per-PTE safety checks (write-fault, unshare),
3/5
mm/gup: add gup_fill_pages() and use it
[mm/gup: add gup_fill_pages() and use it] follow_huge_pud(), follow_huge_pmd(), and follow_page_pte_commit() each store the page they found into pages[0] and flush its caches with the same three lines
4/5
mm/gup: return a huge page's full count from follow_page_mask()
[mm/gup: return a huge page’s full count from follow_page_mask()] follow_huge_pud()/follow_huge_pmd() already know the huge page’s full size but report it via a separate *page_mask output; _get_user
5/5
mm/gup: walk multiple PTEs per follow_page_pte() call
[mm/gup: walk multiple PTEs per follow_page_pte() call] follow_page_pte() still looks at one PTE per call, so __get_user_pages() calls it once per page even for a PTE-mapped large folio (mTHP), restar