diff mbox series

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

Message ID 20231104035522.2418660-9-wangkefeng.wang@huawei.com (mailing list archive)
State New
Headers show
Series mm: convert mm counter to take a folio | expand

Commit Message

Kefeng Wang Nov. 4, 2023, 3:55 a.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(-)
diff mbox series

Patch

diff --git a/mm/memory.c b/mm/memory.c
index ac247850919a..a2cf240b1975 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1850,10 +1850,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));