[08/10] mm: memory: use a folio in insert_page_into_pte_locked()

Message ID 20231106154950.3399469-9-wangkefeng.wang@huawei.com
State New
Headers
Series mm: convert mm counter to take a folio |

Commit Message

Kefeng Wang Nov. 6, 2023, 3:49 p.m. UTC
  Use a folio in insert_page_into_pte_locked(), which is preparetion
for converting mm counter functions to take a folio.

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

Patch

diff --git a/mm/memory.c b/mm/memory.c
index fbed32a09fec..dd3760988e02 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1854,10 +1854,13 @@  static int validate_page_before_insert(struct page *page)
 static int insert_page_into_pte_locked(struct vm_area_struct *vma, pte_t *pte,
 			unsigned long addr, struct page *page, pgprot_t prot)
 {
+	struct folio *folio;
+
 	if (!pte_none(ptep_get(pte)))
 		return -EBUSY;
+	folio = page_folio(page);
 	/* Ok, finally just insert the thing.. */
-	get_page(page);
+	folio_get(folio);
 	inc_mm_counter(vma->vm_mm, mm_counter_file(page));
 	page_add_file_rmap(page, vma, false);
 	set_pte_at(vma->vm_mm, addr, pte, mk_pte(page, prot));