[3/6] mm: memory: make numa_migrate_prep() to take a folio

Message ID 20230918103213.4166210-4-wangkefeng.wang@huawei.com
State New
Headers
Series mm: convert numa balancing functions to use a folio |

Commit Message

Kefeng Wang Sept. 18, 2023, 10:32 a.m. UTC
  In preparation for large folio numa balancing, make numa_migrate_prep()
to take a folio, no functional change intended.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/huge_memory.c |  2 +-
 mm/internal.h    |  2 +-
 mm/memory.c      | 10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)
  

Patch

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 0da653080d8c..3e34a48fbdd8 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1556,7 +1556,7 @@  vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf)
 	 */
 	if (node_is_toptier(page_nid))
 		last_cpupid = page_cpupid_last(page);
-	target_nid = numa_migrate_prep(page, vma, haddr, page_nid,
+	target_nid = numa_migrate_prep(page_folio(page), vma, haddr, page_nid,
 				       &flags);
 
 	if (target_nid == NUMA_NO_NODE) {
diff --git a/mm/internal.h b/mm/internal.h
index 8c90e966e9f8..f30b81f365c1 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -926,7 +926,7 @@  void vunmap_range_noflush(unsigned long start, unsigned long end);
 
 void __vunmap_range_noflush(unsigned long start, unsigned long end);
 
-int numa_migrate_prep(struct page *page, struct vm_area_struct *vma,
+int numa_migrate_prep(struct folio *folio, struct vm_area_struct *vma,
 		      unsigned long addr, int page_nid, int *flags);
 
 void free_zone_device_page(struct page *page);
diff --git a/mm/memory.c b/mm/memory.c
index a04c90604c73..ce7d9d9eddc4 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4717,10 +4717,10 @@  static vm_fault_t do_fault(struct vm_fault *vmf)
 	return ret;
 }
 
-int numa_migrate_prep(struct page *page, struct vm_area_struct *vma,
+int numa_migrate_prep(struct folio *folio, struct vm_area_struct *vma,
 		      unsigned long addr, int page_nid, int *flags)
 {
-	get_page(page);
+	folio_get(folio);
 
 	/* Record the current PID acceesing VMA */
 	vma_set_access_pid_bit(vma);
@@ -4731,7 +4731,7 @@  int numa_migrate_prep(struct page *page, struct vm_area_struct *vma,
 		*flags |= TNF_FAULT_LOCAL;
 	}
 
-	return mpol_misplaced(page_folio(page), vma, addr);
+	return mpol_misplaced(folio, vma, addr);
 }
 
 static vm_fault_t do_numa_page(struct vm_fault *vmf)
@@ -4805,8 +4805,8 @@  static vm_fault_t do_numa_page(struct vm_fault *vmf)
 		last_cpupid = (-1 & LAST_CPUPID_MASK);
 	else
 		last_cpupid = page_cpupid_last(page);
-	target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid,
-			&flags);
+	target_nid = numa_migrate_prep(page_folio(page), vma, vmf->address,
+				       page_nid, &flags);
 	if (target_nid == NUMA_NO_NODE) {
 		put_page(page);
 		goto out_map;