[RFC PATCH 08/18] mm/memory: use ptdesc in __pte_alloc

alexs at kernel.org alexs at kernel.org
Mon Jul 29 23:47:02 PDT 2024


From: Alex Shi <alexs at kernel.org>

Replace pgtable_t by ptdesc in function __pte_alloc.
We will remove pgtable_t from all place.

Signed-off-by: Alex Shi <alexs at kernel.org>
Cc: linux-kernel at vger.kernel.org
Cc: linux-mm at kvack.org
Cc: Andrew Morton <akpm at linux-foundation.org>
---
 mm/memory.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index b9f5cc0db3eb..5b01d94a0b5f 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -445,13 +445,13 @@ void pmd_install(struct mm_struct *mm, pmd_t *pmd, pgtable_t *pte)
 
 int __pte_alloc(struct mm_struct *mm, pmd_t *pmd)
 {
-	pgtable_t new = pte_alloc_one(mm);
-	if (!new)
+	struct ptdesc *ptdesc = page_ptdesc(pte_alloc_one(mm));
+	if (!ptdesc)
 		return -ENOMEM;
 
-	pmd_install(mm, pmd, &new);
-	if (new)
-		pte_free(mm, new);
+	pmd_install(mm, pmd, (pgtable_t *)&ptdesc);
+	if (ptdesc)
+		pte_free(mm, ptdesc_page(ptdesc));
 	return 0;
 }
 
-- 
2.43.0




More information about the linux-riscv mailing list