Skip to content

Commit 84595f4

Browse files
bibo-maotsbogend
authored andcommitted
MIPS: smp: optimization for flush_tlb_mm when exiting
When process exits or execute new binary, it will call function exit_mmap with old mm, there is such function call trace: exit_mmap(struct mm_struct *mm) --> tlb_finish_mmu(&tlb, 0, -1) --> arch_tlb_finish_mmu(tlb, start, end, force) --> tlb_flush_mmu(tlb); --> tlb_flush(struct mmu_gather *tlb) --> flush_tlb_mm(tlb->mm) It is not necessary to flush tlb since oldmm is not used anymore by the process, there is similar operations on IA64/ARM64 etc, this patch adds such optimization on MIPS. Signed-off-by: Mao Bibo <maobibo@loongson.cn> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 912a442 commit 84595f4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

arch/mips/kernel/smp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,12 @@ static inline void smp_on_each_tlb(void (*func) (void *info), void *info)
518518

519519
void flush_tlb_mm(struct mm_struct *mm)
520520
{
521+
if (!mm)
522+
return;
523+
524+
if (atomic_read(&mm->mm_users) == 0)
525+
return; /* happens as a result of exit_mmap() */
526+
521527
preempt_disable();
522528

523529
if (cpu_has_mmid) {

0 commit comments

Comments
 (0)