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

From: alexs
Date: Tue Jul 30 2024 - 02:45:29 EST


From: Alex Shi <alexs@xxxxxxxxxx>

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

Signed-off-by: Alex Shi <alexs@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: linux-mm@xxxxxxxxx
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---
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