Message ID | 20230612210423.18611-32-vishal.moola@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Split ptdesc from struct page | expand |
On Mon, Jun 12, 2023 at 02:04:20PM -0700, Vishal Moola (Oracle) wrote: > As part of the conversions to replace pgtable constructor/destructors with > ptdesc equivalents, convert various page table functions to use ptdescs. > > Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Acked-by: Mike Rapoport (IBM) <rppt@kernel.org> > --- > arch/sparc/mm/init_64.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c > index 04f9db0c3111..105915cd2eee 100644 > --- a/arch/sparc/mm/init_64.c > +++ b/arch/sparc/mm/init_64.c > @@ -2893,14 +2893,15 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm) > > pgtable_t pte_alloc_one(struct mm_struct *mm) > { > - struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO); > - if (!page) > + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL | __GFP_ZERO, 0); > + > + if (!ptdesc) > return NULL; > - if (!pgtable_pte_page_ctor(page)) { > - __free_page(page); > + if (!pagetable_pte_ctor(ptdesc)) { > + pagetable_free(ptdesc); > return NULL; > } > - return (pte_t *) page_address(page); > + return ptdesc_address(ptdesc); > } > > void pte_free_kernel(struct mm_struct *mm, pte_t *pte) > @@ -2910,10 +2911,10 @@ void pte_free_kernel(struct mm_struct *mm, pte_t *pte) > > static void __pte_free(pgtable_t pte) > { > - struct page *page = virt_to_page(pte); > + struct ptdesc *ptdesc = virt_to_ptdesc(pte); > > - pgtable_pte_page_dtor(page); > - __free_page(page); > + pagetable_pte_dtor(ptdesc); > + pagetable_free(ptdesc); > } > > void pte_free(struct mm_struct *mm, pgtable_t pte) > -- > 2.40.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 04f9db0c3111..105915cd2eee 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -2893,14 +2893,15 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm) pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO); - if (!page) + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL | __GFP_ZERO, 0); + + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - return (pte_t *) page_address(page); + return ptdesc_address(ptdesc); } void pte_free_kernel(struct mm_struct *mm, pte_t *pte) @@ -2910,10 +2911,10 @@ void pte_free_kernel(struct mm_struct *mm, pte_t *pte) static void __pte_free(pgtable_t pte) { - struct page *page = virt_to_page(pte); + struct ptdesc *ptdesc = virt_to_ptdesc(pte); - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void pte_free(struct mm_struct *mm, pgtable_t pte)
As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> --- arch/sparc/mm/init_64.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)