aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/tlbflush.h
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@intel.com>2012-06-27 21:02:22 -0400
committerH. Peter Anvin <hpa@zytor.com>2012-06-27 22:29:11 -0400
commit611ae8e3f5204f7480b3b405993b3352cfa16662 (patch)
treefc8d829c331eafccc0939f2ed10655f605bac8c7 /arch/x86/include/asm/tlbflush.h
parent597e1c3580b7cfd95bb0f3167e2b297bf8a5a3ae (diff)
x86/tlb: enable tlb flush range support for x86
Not every tlb_flush execution moment is really need to evacuate all TLB entries, like in munmap, just few 'invlpg' is better for whole process performance, since it leaves most of TLB entries for later accessing. This patch also rewrite flush_tlb_range for 2 purposes: 1, split it out to get flush_blt_mm_range function. 2, clean up to reduce line breaking, thanks for Borislav's input. My micro benchmark 'mummap' http://lkml.org/lkml/2012/5/17/59 show that the random memory access on other CPU has 0~50% speed up on a 2P * 4cores * HT NHM EP while do 'munmap'. Thanks Yongjie's testing on this patch: ------------- I used Linux 3.4-RC6 w/ and w/o his patches as Xen dom0 and guest kernel. After running two benchmarks in Xen HVM guest, I found his patches brought about 1%~3% performance gain in 'kernel build' and 'netperf' testing, though the performance gain was not very stable in 'kernel build' testing. Some detailed testing results are below. Testing Environment: Hardware: Romley-EP platform Xen version: latest upstream Linux kernel: 3.4-RC6 Guest vCPU number: 8 NIC: Intel 82599 (10GB bandwidth) In 'kernel build' testing in guest: Command line | performance gain make -j 4 | 3.81% make -j 8 | 0.37% make -j 16 | -0.52% In 'netperf' testing, we tested TCP_STREAM with default socket size 16384 byte as large packet and 64 byte as small packet. I used several clients to add networking pressure, then 'netperf' server automatically generated several threads to response them. I also used large-size packet and small-size packet in the testing. Packet size | Thread number | performance gain 16384 bytes | 4 | 0.02% 16384 bytes | 8 | 2.21% 16384 bytes | 16 | 2.04% 64 bytes | 4 | 1.07% 64 bytes | 8 | 3.31% 64 bytes | 16 | 0.71% Signed-off-by: Alex Shi <alex.shi@intel.com> Link: http://lkml.kernel.org/r/1340845344-27557-8-git-send-email-alex.shi@intel.com Tested-by: Ren, Yongjie <yongjie.ren@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/include/asm/tlbflush.h')
-rw-r--r--arch/x86/include/asm/tlbflush.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index 33608d96d68b..621b959e1dbf 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -105,6 +105,13 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
105 __flush_tlb(); 105 __flush_tlb();
106} 106}
107 107
108static inline void flush_tlb_mm_range(struct vm_area_struct *vma,
109 unsigned long start, unsigned long end, unsigned long vmflag)
110{
111 if (vma->vm_mm == current->active_mm)
112 __flush_tlb();
113}
114
108static inline void native_flush_tlb_others(const struct cpumask *cpumask, 115static inline void native_flush_tlb_others(const struct cpumask *cpumask,
109 struct mm_struct *mm, 116 struct mm_struct *mm,
110 unsigned long start, 117 unsigned long start,
@@ -122,12 +129,16 @@ static inline void reset_lazy_tlbstate(void)
122 129
123#define local_flush_tlb() __flush_tlb() 130#define local_flush_tlb() __flush_tlb()
124 131
132#define flush_tlb_mm(mm) flush_tlb_mm_range(mm, 0UL, TLB_FLUSH_ALL, 0UL)
133
134#define flush_tlb_range(vma, start, end) \
135 flush_tlb_mm_range(vma->vm_mm, start, end, vma->vm_flags)
136
125extern void flush_tlb_all(void); 137extern void flush_tlb_all(void);
126extern void flush_tlb_current_task(void); 138extern void flush_tlb_current_task(void);
127extern void flush_tlb_mm(struct mm_struct *);
128extern void flush_tlb_page(struct vm_area_struct *, unsigned long); 139extern void flush_tlb_page(struct vm_area_struct *, unsigned long);
129extern void flush_tlb_range(struct vm_area_struct *vma, 140extern void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
130 unsigned long start, unsigned long end); 141 unsigned long end, unsigned long vmflag);
131 142
132#define flush_tlb() flush_tlb_current_task() 143#define flush_tlb() flush_tlb_current_task()
133 144