mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
mm: pgtable: add statistics for P4D level page table
Like other levels of page tables, add statistics for P4D level page table. Link: https://lkml.kernel.org/r/d55fe3c286305aae84457da9e1066df99b3de125.1736317725.git.zhengqi.arch@bytedance.com Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> Originally-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> 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:
@@ -108,8 +108,12 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
|
||||
static inline void __p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
|
||||
unsigned long addr)
|
||||
{
|
||||
if (pgtable_l5_enabled)
|
||||
if (pgtable_l5_enabled) {
|
||||
struct ptdesc *ptdesc = virt_to_ptdesc(p4d);
|
||||
|
||||
pagetable_p4d_dtor(ptdesc);
|
||||
riscv_tlb_remove_ptdesc(tlb, virt_to_ptdesc(p4d));
|
||||
}
|
||||
}
|
||||
#endif /* __PAGETABLE_PMD_FOLDED */
|
||||
|
||||
|
||||
@@ -94,6 +94,9 @@ void ___pud_free_tlb(struct mmu_gather *tlb, pud_t *pud)
|
||||
#if CONFIG_PGTABLE_LEVELS > 4
|
||||
void ___p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d)
|
||||
{
|
||||
struct ptdesc *ptdesc = virt_to_ptdesc(p4d);
|
||||
|
||||
pagetable_p4d_dtor(ptdesc);
|
||||
paravirt_release_p4d(__pa(p4d) >> PAGE_SHIFT);
|
||||
paravirt_tlb_remove_table(tlb, virt_to_page(p4d));
|
||||
}
|
||||
|
||||
@@ -230,6 +230,7 @@ static inline p4d_t *__p4d_alloc_one_noprof(struct mm_struct *mm, unsigned long
|
||||
if (!ptdesc)
|
||||
return NULL;
|
||||
|
||||
pagetable_p4d_ctor(ptdesc);
|
||||
return ptdesc_address(ptdesc);
|
||||
}
|
||||
#define __p4d_alloc_one(...) alloc_hooks(__p4d_alloc_one_noprof(__VA_ARGS__))
|
||||
@@ -247,6 +248,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_p4d_dtor(ptdesc);
|
||||
pagetable_free(ptdesc);
|
||||
}
|
||||
|
||||
|
||||
@@ -3175,6 +3175,22 @@ static inline void pagetable_pud_dtor(struct ptdesc *ptdesc)
|
||||
lruvec_stat_sub_folio(folio, NR_PAGETABLE);
|
||||
}
|
||||
|
||||
static inline void pagetable_p4d_ctor(struct ptdesc *ptdesc)
|
||||
{
|
||||
struct folio *folio = ptdesc_folio(ptdesc);
|
||||
|
||||
__folio_set_pgtable(folio);
|
||||
lruvec_stat_add_folio(folio, NR_PAGETABLE);
|
||||
}
|
||||
|
||||
static inline void pagetable_p4d_dtor(struct ptdesc *ptdesc)
|
||||
{
|
||||
struct folio *folio = ptdesc_folio(ptdesc);
|
||||
|
||||
__folio_clear_pgtable(folio);
|
||||
lruvec_stat_sub_folio(folio, NR_PAGETABLE);
|
||||
}
|
||||
|
||||
extern void __init pagecache_init(void);
|
||||
extern void free_initmem(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user