Skip to contentSkip to conversation

mm-pgtable-add-statistics-for-p4d-level-page-table.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jan 14, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: pgtable: add statistics for P4D level page table
has been removed from the -mm tree. Its filename was
mm-pgtable-add-statistics-for-p4d-level-page-table.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Qi Zheng <[email protected]>
Subject: mm: pgtable: add statistics for P4D level page table
Date: Wed, 8 Jan 2025 14:57:20 +0800

Like other levels of page tables, add statistics for P4D level page table.

Cc Alexander Gordeev <[email protected]>
Cc Alexandre Ghiti <[email protected]>
Cc Alexandre Ghiti <[email protected]>
Cc Andreas Larsson <[email protected]>
Cc Aneesh Kumar K.V (Arm) <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Dave Hansen <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc David Rientjes <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Jann Horn <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Mike Rapoport (Microsoft) <[email protected]>
Cc Muchun Song <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vishal Moola (Oracle) <[email protected]>
Cc Will Deacon <[email protected]>
Cc Yu Zhao <[email protected]>

---

 arch/riscv/include/asm/pgalloc.h |    6 +++++-
 arch/x86/mm/pgtable.c            |    3 +++
 include/asm-generic/pgalloc.h    |    2 ++
 include/linux/mm.h               |   16 ++++++++++++++++
 4 files changed, 26 insertions(+), 1 deletion(-)
arch/riscv/include/asm/pgalloc.h renamed from arch/riscv/include/asm/pgalloc.h~mm-pgtable-add-statistics-for-p4d-level-page-table +5 -1
@@ -108,8 +108,12 @@ static inline void __pud_free_tlb(struct
 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 */
 
arch/x86/mm/pgtable.c renamed from arch/x86/mm/pgtable.c~mm-pgtable-add-statistics-for-p4d-level-page-table +3 -0
@@ -94,6 +94,9 @@ void ___pud_free_tlb(struct mmu_gather *
 #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));
 }
include/asm-generic/pgalloc.h renamed from include/asm-generic/pgalloc.h~mm-pgtable-add-statistics-for-p4d-level-page-table +2 -0
@@ -230,6 +230,7 @@ static inline p4d_t *__p4d_alloc_one_nop
 	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 ptdesc *ptdesc = virt_to_ptdesc(p4d);
 
 	BUG_ON((unsigned long)p4d & (PAGE_SIZE-1));
+	pagetable_p4d_dtor(ptdesc);
 	pagetable_free(ptdesc);
 }
 
include/linux/mm.h renamed from include/linux/mm.h~mm-pgtable-add-statistics-for-p4d-level-page-table +16 -0
@@ -3175,6 +3175,22 @@ static inline void pagetable_pud_dtor(st
 	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);
 

_

Patches currently in -mm which might be from [email protected] are