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

alexs
2024-07-30T06:44:45Z

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

Signed-off-by: Alex Shi <alexs@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: Andrew Morton <akpm@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;