[-next,4/7] mm: memory: convert page_copy_prealloc() to use a folio

Message ID 20230112083006.163393-5-wangkefeng.wang@huawei.com
State New
Headers
Series mm: remove cgroup_throttle_swaprate() completely |

Commit Message

Kefeng Wang Jan. 12, 2023, 8:30 a.m. UTC
  The page functions are converted to corresponding to folio functions
in page_copy_prealloc().

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/memory.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
  

Patch

diff --git a/mm/memory.c b/mm/memory.c
index f29bca499e0d..b66c425b4d7c 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -958,19 +958,19 @@  static inline struct page *
 page_copy_prealloc(struct mm_struct *src_mm, struct vm_area_struct *vma,
 		   unsigned long addr)
 {
-	struct page *new_page;
+	struct folio *new_folio;
 
-	new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, addr);
-	if (!new_page)
+	new_folio = vma_alloc_folio(GFP_HIGHUSER_MOVABLE, 0, vma, addr, false);
+	if (!new_folio)
 		return NULL;
 
-	if (mem_cgroup_charge(page_folio(new_page), src_mm, GFP_KERNEL)) {
-		put_page(new_page);
+	if (mem_cgroup_charge(new_folio, src_mm, GFP_KERNEL)) {
+		folio_put(new_folio);
 		return NULL;
 	}
-	cgroup_throttle_swaprate(new_page, GFP_KERNEL);
+	folio_throttle_swaprate(new_folio, GFP_KERNEL);
 
-	return new_page;
+	return &new_folio->page;
 }
 
 static int