aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/mmu_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/mmu_context.h')
-rw-r--r--arch/x86/include/asm/mmu_context.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 40269a2bf6f9..4b75d591eb5e 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -130,7 +130,25 @@ static inline void arch_bprm_mm_init(struct mm_struct *mm,
130static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma, 130static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
131 unsigned long start, unsigned long end) 131 unsigned long start, unsigned long end)
132{ 132{
133 mpx_notify_unmap(mm, vma, start, end); 133 /*
134 * mpx_notify_unmap() goes and reads a rarely-hot
135 * cacheline in the mm_struct. That can be expensive
136 * enough to be seen in profiles.
137 *
138 * The mpx_notify_unmap() call and its contents have been
139 * observed to affect munmap() performance on hardware
140 * where MPX is not present.
141 *
142 * The unlikely() optimizes for the fast case: no MPX
143 * in the CPU, or no MPX use in the process. Even if
144 * we get this wrong (in the unlikely event that MPX
145 * is widely enabled on some system) the overhead of
146 * MPX itself (reading bounds tables) is expected to
147 * overwhelm the overhead of getting this unlikely()
148 * consistently wrong.
149 */
150 if (unlikely(cpu_feature_enabled(X86_FEATURE_MPX)))
151 mpx_notify_unmap(mm, vma, start, end);
134} 152}
135 153
136#endif /* _ASM_X86_MMU_CONTEXT_H */ 154#endif /* _ASM_X86_MMU_CONTEXT_H */