Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

s390: pgtable: consolidate PxD and PTE TLB free paths

Call pagetable_dtor() for PMD|PUD|P4D tables just before ptdesc is freed -
same as it is done for PTE tables. That allows consolidating TLB free
paths for all table types.

Link: https://lkml.kernel.org/r/ac69360a5f3350ebb2f63cd14b7b45316a130ee4.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>
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>

authored by

Qi Zheng and committed by
Andrew Morton
5550b3c5 ee0934b0

+4 -13
-3
arch/s390/include/asm/tlb.h
··· 102 102 { 103 103 if (mm_pmd_folded(tlb->mm)) 104 104 return; 105 - pagetable_dtor(virt_to_ptdesc(pmd)); 106 105 __tlb_adjust_range(tlb, address, PAGE_SIZE); 107 106 tlb->mm->context.flush_mm = 1; 108 107 tlb->freed_tables = 1; ··· 121 122 { 122 123 if (mm_p4d_folded(tlb->mm)) 123 124 return; 124 - pagetable_dtor(virt_to_ptdesc(p4d)); 125 125 __tlb_adjust_range(tlb, address, PAGE_SIZE); 126 126 tlb->mm->context.flush_mm = 1; 127 127 tlb->freed_tables = 1; ··· 139 141 { 140 142 if (mm_pud_folded(tlb->mm)) 141 143 return; 142 - pagetable_dtor(virt_to_ptdesc(pud)); 143 144 tlb->mm->context.flush_mm = 1; 144 145 tlb->freed_tables = 1; 145 146 tlb->cleared_p4ds = 1;
+4 -10
arch/s390/mm/pgalloc.c
··· 180 180 return table; 181 181 } 182 182 183 - static void pagetable_pte_dtor_free(struct ptdesc *ptdesc) 183 + static void pagetable_dtor_free(struct ptdesc *ptdesc) 184 184 { 185 185 pagetable_dtor(ptdesc); 186 186 pagetable_free(ptdesc); ··· 190 190 { 191 191 struct ptdesc *ptdesc = virt_to_ptdesc(table); 192 192 193 - pagetable_pte_dtor_free(ptdesc); 193 + pagetable_dtor_free(ptdesc); 194 194 } 195 195 196 196 void __tlb_remove_table(void *table) 197 197 { 198 198 struct ptdesc *ptdesc = virt_to_ptdesc(table); 199 - struct page *page = ptdesc_page(ptdesc); 200 199 201 - if (compound_order(page) == CRST_ALLOC_ORDER) { 202 - /* pmd, pud, or p4d */ 203 - pagetable_free(ptdesc); 204 - return; 205 - } 206 - pagetable_pte_dtor_free(ptdesc); 200 + pagetable_dtor_free(ptdesc); 207 201 } 208 202 209 203 #ifdef CONFIG_TRANSPARENT_HUGEPAGE ··· 205 211 { 206 212 struct ptdesc *ptdesc = container_of(head, struct ptdesc, pt_rcu_head); 207 213 208 - pagetable_pte_dtor_free(ptdesc); 214 + pagetable_dtor_free(ptdesc); 209 215 } 210 216 211 217 void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable)