Commit 67741ba3 authored by Paul Burton's avatar Paul Burton

MIPS: mm: Avoid HTW stop/start when dropping an inactive mm

If drop_mmu_context() is called with an mm that is not currently active
on the local CPU then there's no need for us to stop & start a hardware
page table walker because it can't be fetching entries for the ASID
corresponding to the mm we're operating on.

Move the htw_stop() & htw_start() calls into the block which we run only
if the mm is currently active, in order to avoid the redundant work.
Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
Cc: linux-mips@vger.kernel.org
parent 4739f7dd
...@@ -184,17 +184,18 @@ drop_mmu_context(struct mm_struct *mm) ...@@ -184,17 +184,18 @@ drop_mmu_context(struct mm_struct *mm)
unsigned int cpu; unsigned int cpu;
local_irq_save(flags); local_irq_save(flags);
htw_stop();
cpu = smp_processor_id(); cpu = smp_processor_id();
if (cpumask_test_cpu(cpu, mm_cpumask(mm))) { if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
htw_stop();
get_new_mmu_context(mm); get_new_mmu_context(mm);
write_c0_entryhi(cpu_asid(cpu, mm)); write_c0_entryhi(cpu_asid(cpu, mm));
htw_start();
} else { } else {
/* will get a new context next time */ /* will get a new context next time */
cpu_context(cpu, mm) = 0; cpu_context(cpu, mm) = 0;
} }
htw_start();
local_irq_restore(flags); local_irq_restore(flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment