diff options
author | Shaohua Li <shaohua.li@intel.com> | 2010-08-15 21:16:55 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-08-23 13:04:57 -0400 |
commit | 61c77326d1df079f202fa79403c3ccd8c5966a81 (patch) | |
tree | 57780e6b94f24f402d1c9036d6e7cf37a359c22f /include/asm-generic | |
parent | 76be97c1fc945db08aae1f1b746012662d643e97 (diff) |
x86, mm: Avoid unnecessary TLB flush
In x86, access and dirty bits are set automatically by CPU when CPU accesses
memory. When we go into the code path of below flush_tlb_fix_spurious_fault(),
we already set dirty bit for pte and don't need flush tlb. This might mean
tlb entry in some CPUs hasn't dirty bit set, but this doesn't matter. When
the CPUs do page write, they will automatically check the bit and no software
involved.
On the other hand, flush tlb in below position is harmful. Test creates CPU
number of threads, each thread writes to a same but random address in same vma
range and we measure the total time. Under a 4 socket system, original time is
1.96s, while with the patch, the time is 0.8s. Under a 2 socket system, there is
20% time cut too. perf shows a lot of time are taking to send ipi/handle ipi for
tlb flush.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
LKML-Reference: <20100816011655.GA362@sli10-desk.sh.intel.com>
Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Andrea Archangeli <aarcange@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/pgtable.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index e2bd73e8f9c0..f4d4120e5128 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -129,6 +129,10 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres | |||
129 | #define move_pte(pte, prot, old_addr, new_addr) (pte) | 129 | #define move_pte(pte, prot, old_addr, new_addr) (pte) |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | #ifndef flush_tlb_fix_spurious_fault | ||
133 | #define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) | ||
134 | #endif | ||
135 | |||
132 | #ifndef pgprot_noncached | 136 | #ifndef pgprot_noncached |
133 | #define pgprot_noncached(prot) (prot) | 137 | #define pgprot_noncached(prot) (prot) |
134 | #endif | 138 | #endif |