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.

powerpc/64s: free page table caches at exit_mmap time

The kernel page table caches are tied to init_mm, so there is no
more need for them after userspace is finished.

destroy_context() gets called when we drop the last reference for an
mm, which can be much later than the task exit due to other lazy mm
references to it. We can free the page table cache pages on task exit
because they only cache the userspace page tables and kernel threads
should not access user space addresses.

The mapping for kernel threads itself is maintained in init_mm and
page table cache for that is attached to init_mm.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
[mpe: Merge change log additions from Aneesh]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Nicholas Piggin and committed by
Michael Ellerman
34c604d2 5a609934

+3 -2
+3 -2
arch/powerpc/mm/mmu_context_book3s64.c
··· 221 221 } 222 222 } 223 223 224 - static void destroy_pagetable_page(struct mm_struct *mm) 224 + static void destroy_pagetable_cache(struct mm_struct *mm) 225 225 { 226 226 void *frag; 227 227 ··· 244 244 WARN_ON(process_tb[mm->context.id].prtb0 != 0); 245 245 else 246 246 subpage_prot_free(mm); 247 - destroy_pagetable_page(mm); 248 247 destroy_contexts(&mm->context); 249 248 mm->context.id = MMU_NO_CONTEXT; 250 249 } 251 250 252 251 void arch_exit_mmap(struct mm_struct *mm) 253 252 { 253 + destroy_pagetable_cache(mm); 254 + 254 255 if (radix_enabled()) { 255 256 /* 256 257 * Radix doesn't have a valid bit in the process table