* [patch] x86: tlb flush avoid superflous leave_mm()
@ 2011-09-02 7:07 Shaohua Li
2011-09-13 5:35 ` Shaohua Li
0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2011-09-02 7:07 UTC (permalink / raw)
To: lkml; +Cc: Ingo Molnar, hpa
If just one page VA tlb is required to be flushed and current task is in lazy
TLB state, doing leave_mm() is superfluous because it flushes the whole TLB.
This can reduce some TLB miss.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index d6c0418..3041665 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -153,13 +153,13 @@ void smp_invalidate_interrupt(struct pt_regs *regs)
*/
if (f->flush_mm == percpu_read(cpu_tlbstate.active_mm)) {
- if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) {
- if (f->flush_va == TLB_FLUSH_ALL)
+ if (f->flush_va == TLB_FLUSH_ALL) {
+ if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK)
local_flush_tlb();
else
- __flush_tlb_one(f->flush_va);
+ leave_mm(cpu);
} else
- leave_mm(cpu);
+ __flush_tlb_one(f->flush_va);
}
out:
ack_APIC_irq();
@@ -306,12 +306,8 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
preempt_disable();
- if (current->active_mm == mm) {
- if (current->mm)
- __flush_tlb_one(va);
- else
- leave_mm(smp_processor_id());
- }
+ if (current->active_mm == mm)
+ __flush_tlb_one(va);
if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids)
flush_tlb_others(mm_cpumask(mm), mm, va);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch] x86: tlb flush avoid superflous leave_mm()
2011-09-02 7:07 [patch] x86: tlb flush avoid superflous leave_mm() Shaohua Li
@ 2011-09-13 5:35 ` Shaohua Li
0 siblings, 0 replies; 2+ messages in thread
From: Shaohua Li @ 2011-09-13 5:35 UTC (permalink / raw)
To: lkml; +Cc: Ingo Molnar, hpa
On Fri, 2011-09-02 at 15:07 +0800, Shaohua Li wrote:
> If just one page VA tlb is required to be flushed and current task is in lazy
> TLB state, doing leave_mm() is superfluous because it flushes the whole TLB.
> This can reduce some TLB miss.
ping, any comments?
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
>
> diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
> index d6c0418..3041665 100644
> --- a/arch/x86/mm/tlb.c
> +++ b/arch/x86/mm/tlb.c
> @@ -153,13 +153,13 @@ void smp_invalidate_interrupt(struct pt_regs *regs)
> */
>
> if (f->flush_mm == percpu_read(cpu_tlbstate.active_mm)) {
> - if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) {
> - if (f->flush_va == TLB_FLUSH_ALL)
> + if (f->flush_va == TLB_FLUSH_ALL) {
> + if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK)
> local_flush_tlb();
> else
> - __flush_tlb_one(f->flush_va);
> + leave_mm(cpu);
> } else
> - leave_mm(cpu);
> + __flush_tlb_one(f->flush_va);
> }
> out:
> ack_APIC_irq();
> @@ -306,12 +306,8 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
>
> preempt_disable();
>
> - if (current->active_mm == mm) {
> - if (current->mm)
> - __flush_tlb_one(va);
> - else
> - leave_mm(smp_processor_id());
> - }
> + if (current->active_mm == mm)
> + __flush_tlb_one(va);
>
> if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids)
> flush_tlb_others(mm_cpumask(mm), mm, va);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-13 5:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02 7:07 [patch] x86: tlb flush avoid superflous leave_mm() Shaohua Li
2011-09-13 5:35 ` Shaohua Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®