mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 15:03:53 +02:00
mm: pgtable: introduce generic pagetable_dtor_free()
The pte_free(), pmd_free(), __pud_free() and __p4d_free() in asm-generic/pgalloc.h and the generic __tlb_remove_table() are basically the same, so let's introduce pagetable_dtor_free() to deduplicate them. In addition, the pagetable_dtor_free() in s390 does the same thing, so let's s390 also calls generic pagetable_dtor_free(). Link: https://lkml.kernel.org/r/1663a0565aca881d1338ceb7d1db4aa9c333abd6.1736317725.git.zhengqi.arch@bytedance.com Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> [s390] Cc: Alexandre Ghiti <alex@ghiti.fr> Cc: Alexandre Ghiti <alexghiti@rivosinc.com> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Hildenbrand <david@redhat.com> Cc: David Rientjes <rientjes@google.com> Cc: Hugh Dickins <hughd@google.com> Cc: Jann Horn <jannh@google.com> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Mike Rapoport (Microsoft) <rppt@kernel.org> Cc: Muchun Song <muchun.song@linux.dev> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com> Cc: Will Deacon <will@kernel.org> Cc: Yu Zhao <yuzhao@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
e74e173101
commit
553e77529f
|
@ -180,12 +180,6 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
|
|||
return table;
|
||||
}
|
||||
|
||||
static void pagetable_dtor_free(struct ptdesc *ptdesc)
|
||||
{
|
||||
pagetable_dtor(ptdesc);
|
||||
pagetable_free(ptdesc);
|
||||
}
|
||||
|
||||
void page_table_free(struct mm_struct *mm, unsigned long *table)
|
||||
{
|
||||
struct ptdesc *ptdesc = virt_to_ptdesc(table);
|
||||
|
|
|
@ -109,8 +109,7 @@ static inline void pte_free(struct mm_struct *mm, struct page *pte_page)
|
|||
{
|
||||
struct ptdesc *ptdesc = page_ptdesc(pte_page);
|
||||
|
||||
pagetable_dtor(ptdesc);
|
||||
pagetable_free(ptdesc);
|
||||
pagetable_dtor_free(ptdesc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,8 +152,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
|
|||
struct ptdesc *ptdesc = virt_to_ptdesc(pmd);
|
||||
|
||||
BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
|
||||
pagetable_dtor(ptdesc);
|
||||
pagetable_free(ptdesc);
|
||||
pagetable_dtor_free(ptdesc);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -202,8 +200,7 @@ static inline void __pud_free(struct mm_struct *mm, pud_t *pud)
|
|||
struct ptdesc *ptdesc = virt_to_ptdesc(pud);
|
||||
|
||||
BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
|
||||
pagetable_dtor(ptdesc);
|
||||
pagetable_free(ptdesc);
|
||||
pagetable_dtor_free(ptdesc);
|
||||
}
|
||||
|
||||
#ifndef __HAVE_ARCH_PUD_FREE
|
||||
|
@ -248,8 +245,7 @@ static inline void __p4d_free(struct mm_struct *mm, p4d_t *p4d)
|
|||
struct ptdesc *ptdesc = virt_to_ptdesc(p4d);
|
||||
|
||||
BUG_ON((unsigned long)p4d & (PAGE_SIZE-1));
|
||||
pagetable_dtor(ptdesc);
|
||||
pagetable_free(ptdesc);
|
||||
pagetable_dtor_free(ptdesc);
|
||||
}
|
||||
|
||||
#ifndef __HAVE_ARCH_P4D_FREE
|
||||
|
|
|
@ -213,8 +213,7 @@ static inline void __tlb_remove_table(void *table)
|
|||
{
|
||||
struct ptdesc *ptdesc = (struct ptdesc *)table;
|
||||
|
||||
pagetable_dtor(ptdesc);
|
||||
pagetable_free(ptdesc);
|
||||
pagetable_dtor_free(ptdesc);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -3001,6 +3001,12 @@ static inline void pagetable_dtor(struct ptdesc *ptdesc)
|
|||
lruvec_stat_sub_folio(folio, NR_PAGETABLE);
|
||||
}
|
||||
|
||||
static inline void pagetable_dtor_free(struct ptdesc *ptdesc)
|
||||
{
|
||||
pagetable_dtor(ptdesc);
|
||||
pagetable_free(ptdesc);
|
||||
}
|
||||
|
||||
static inline bool pagetable_pte_ctor(struct ptdesc *ptdesc)
|
||||
{
|
||||
struct folio *folio = ptdesc_folio(ptdesc);
|
||||
|
|
Loading…
Reference in New Issue
Block a user