Re: [PATCH v4 5/6] mm: convert copy_user_huge_page() to copy_user_folio()

From: zhangpeng (AS)
Date: Fri Mar 31 2023 - 05:39:17 EST


On 2023/3/31 2:15, Matthew Wilcox wrote:

On Thu, Mar 30, 2023 at 09:40:44PM +0800, Peng Zhang wrote:
+void copy_user_folio(struct folio *dst, struct folio *src,
+ unsigned long addr_hint,
+ struct vm_area_struct *vma,
+ unsigned int pages_per_huge_page);
Do we really want to pass in pages_per_huge_page here? We can get
that from folio_nr_pages(dst).

Agreed. It's not necessary to pass in pages_per_huge_page. I'll remove
it in a v5.

+++ b/mm/hugetlb.c
@@ -5097,8 +5097,8 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
ret = PTR_ERR(new_folio);
break;
}
- copy_user_huge_page(&new_folio->page, ptepage, addr, dst_vma,
- npages);
+ copy_user_folio(new_folio, page_folio(ptepage), addr, dst_vma,
+ npages);
put_page(ptepage);
This function should be converted to s/ptepage/pte_folio/, but that's
not for this patch series.

Appreciate your suggestion. I'll convert this function in a future patch
set.

- copy_user_huge_page(&new_folio->page, old_page, address, vma,
- pages_per_huge_page(h));
+ copy_user_folio(new_folio, page_folio(old_page), address, vma,
+ pages_per_huge_page(h));
Likewise for s/old_page/old_folio/

Will also convert this.

Best Regards,
Peng