login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
August
»
23
Re: [patch]x86: avoid unnecessary tlb flush
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Shaohua Li
Subject:
Re: [patch]x86: avoid unnecessary tlb flush
Date: Sunday, August 22, 2010 - 5:43 pm
On Mon, Aug 16, 2010 at 09:16:55AM +0800, Shaohua Li wrote:
quoted text
> On Sat, Aug 14, 2010 at 07:00:37AM +0800, Siddha, Suresh B wrote: > > On Fri, 2010-08-13 at 14:08 -0700, H. Peter Anvin wrote: > > > On 08/13/2010 12:29 PM, Hugh Dickins wrote: > > > > > > > > Just added Andrea to the Cc list: he did that TLB flush in 1a44e149, > > > > I'd feel more comfortable noop-ing it on x86 if you've convinced him. > > > > > > > > Hugh > > > > > > Andrea is probably on his way back from LinuxCon, but looking at the > > > original patch it might be something that non-x86 architectures need, > > > but which can be optimized specifically on x86, since x86 has explicit > > > "no flush needed when going to more permissive" semantics. > > > > Yes. I don't see a problem with the proposed patch. This is the case of > > parallel thread execution getting spurious write protection faults for > > the same page for which the pte entry is already up to date and the > > fault has already flushed the existing spurious TLB entry in the case of > > x86. > > > > I prefer a better name for the new flush_tlb_nonprotect_page() to > > reflect the above. something like tlb_fix_spurious_fault() or something? > this name is better.
Hi Andrea, can you look at this patch? Thanks, Shaohua
quoted text
> 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> > Acked-by: Suresh Siddha <suresh.b.siddha@intel.com> > > --- > arch/x86/include/asm/pgtable.h | 2 ++ > include/asm-generic/pgtable.h | 4 ++++ > mm/memory.c | 2 +- > 3 files changed, 7 insertions(+), 1 deletion(-) > > Index: linux/arch/x86/include/asm/pgtable.h > =================================================================== > --- linux.orig/arch/x86/include/asm/pgtable.h 2010-08-16 09:00:02.000000000 +0800 > +++ linux/arch/x86/include/asm/pgtable.h 2010-08-16 09:03:41.000000000 +0800 > @@ -603,6 +603,8 @@ static inline void ptep_set_wrprotect(st > pte_update(mm, addr, ptep); > } > > +#define flush_tlb_fix_spurious_fault(vma, address) > + > /* > * clone_pgd_range(pgd_t *dst, pgd_t *src, int count); > * > Index: linux/include/asm-generic/pgtable.h > =================================================================== > --- linux.orig/include/asm-generic/pgtable.h 2010-08-16 09:00:02.000000000 +0800 > +++ linux/include/asm-generic/pgtable.h 2010-08-16 09:03:41.000000000 +0800 > @@ -129,6 +129,10 @@ static inline void ptep_set_wrprotect(st > #define move_pte(pte, prot, old_addr, new_addr) (pte) > #endif > > +#ifndef flush_tlb_fix_spurious_fault > +#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) > +#endif > + > #ifndef pgprot_noncached > #define pgprot_noncached(prot) (prot) > #endif > Index: linux/mm/memory.c > =================================================================== > --- linux.orig/mm/memory.c 2010-08-16 09:03:08.000000000 +0800 > +++ linux/mm/memory.c 2010-08-16 09:03:41.000000000 +0800 > @@ -3140,7 +3140,7 @@ static inline int handle_pte_fault(struc > * with threads. > */ > if (flags & FAULT_FLAG_WRITE) > - flush_tlb_page(vma, address); > + flush_tlb_fix_spurious_fault(vma, address); > } > unlock: > pte_unmap_unlock(pte, ptl);
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[patch]x86: avoid unnecessary tlb flush
, Shaohua Li
, (Thu Aug 5, 8:28 pm)
Re: [patch]x86: avoid unnecessary tlb flush
, Andrew Morton
, (Thu Aug 5, 10:19 pm)
Re: [patch]x86: avoid unnecessary tlb flush
, Shaohua Li
, (Thu Aug 12, 5:47 pm)
Re: [patch]x86: avoid unnecessary tlb flush
, Hugh Dickins
, (Fri Aug 13, 12:29 pm)
Re: [patch]x86: avoid unnecessary tlb flush
, H. Peter Anvin
, (Fri Aug 13, 2:08 pm)
Re: [patch]x86: avoid unnecessary tlb flush
, Suresh Siddha
, (Fri Aug 13, 4:00 pm)
Re: [patch]x86: avoid unnecessary tlb flush
, Shaohua Li
, (Sun Aug 15, 6:16 pm)
Re: [patch]x86: avoid unnecessary tlb flush
, Shaohua Li
, (Sun Aug 22, 5:43 pm)
[tip:x86/mm] x86, mm: Avoid unnecessary TLB flush
, tip-bot for Shaohua Li
, (Mon Aug 23, 10:57 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Ken Chen
[patch] sched: fix inconsistency when redistribute per-cpu tg->cfs_rq shares.
Ingo Molnar
Re: [PATCH v3] x86: merge the simple bitops and move them to bitops.h
Jan Engelhardt
Re: [PATCH] Allow Kconfig to set default mmap_min_addr protection
Dmitry Torokhov
Re: [2.6 patch] input/serio/hp_sdc.c section fix
Rafael J. Wysocki
[Bug #16380] Loop devices act strangely in 2.6.35
git
:
Steven Grimm
Using git as a general backup mechanism (was Re: Using GIT to store /etc)
Jeff King
Re: [PATCH] git-reset: allow --soft in a bare repo
Johannes Sixt
Re: [PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c
Johannes Schindelin
Re: [PATCH] Uninstall rule for top level Makefile
Shawn O. Pearce
Re: [PATCH v2] Speed up bash completion loading
git-commits-head
:
Linux Kernel Mailing List
cgroups: clean up cgroup_pidlist_find() a bit
Linux Kernel Mailing List
sony-laptop: Add support for extended hotkeys
Linux Kernel Mailing List
IB/core: Add support for masked atomic operations
Linux Kernel Mailing List
V4L/DVB (8939): cx18: fix sparse warnings
Linux Kernel Mailing List
ipv6 mcast: Check address family of gf_group in getsockopt(MS_FILTER).
linux-netdev
:
Inaky Perez-Gonzalez
[PATCH 40/40] wimax/i2400m: add CREDITS and MAINTAINERS entries
Karsten Keil
[mISDN PATCH v2 05/19] Reduce stack size in dsp_cmx_send()
linux
Re: 2.6.23-rc8 network problem. Mem leak? ip1000a?
David Miller
Re: tun: Use netif_receive_skb instead of netif_rx
David Miller
Re: [net-next PATCH v2] llc enhancements
freebsd-current
:
Matthew Fleming
Re: [RFC] Outline of USB process integration in the kernel taskqueue system
illoai@gmail.com
Re: OT: 2d password
Hartmut Brandt
Re: problem with nss_ldap
Andrew Reilly
Re: FreeBSD's problems as seen by the BSDForen.de community
Max Laier
Re: Upcoming ABI Breakage in RELENG_7
Colocation donated by:
Syndicate