[CFT:PATCH] Remove a seemingly unnecessary cache flush

Mikael Pettersson mikpe at it.uu.se
Tue Mar 9 10:46:43 EST 2010


On Mon, 7 Dec 2009, Russell King - ARM Linux wrote:
 > While looking into the possible msync() issue (which turned out to be a
 > non-issue - it's covered by clever code), I found that we're flushing
 > the same page multiple times.
 > 
 > Normally, update_mmu_cache() would not be doing anything on architectures
 > which don't have a software-loaded TLB.  However, we use this hook for
 > two things:
 > 
 > 1. for our delayed flush_dcache_page().
 > 2. to fix up multiple shared write-able mappings of the same page.
 > 
 > However, as of 8 years ago, I committed this patch (sorry for the
 > bkbits URL):
 > 
 > http://linux.bkbits.net:8080/linux-2.6/?PAGE=patch&REV=3dd7c1f9DypjNd1HyQFAOsA3p7mYig
 > 
 > What the majority of that patch is doing is adding the user-mapping
 > flushing to __flush_dcache_page() - that's fine, and it's explained in
 > the changeset comments.
 > 
 > It also tries to merge the new __flush_dcache_page() code inside
 > make_coherent() - make_coherent() is sort-of already doing most of what
 > __flush_dcache_page() does, and for good measure it does a final
 > flush_cache_page().
 > 
 > The unused addition of 'dirty' seems to suggest that this extra
 > flush_cache_page should have been conditional on that.
 > 
 > Moreover, this final flush_cache_page() should not be needed - the whole
 > "delayed flush_dcache_page" thing only happens when there are no pre-
 > existing mappings of the page, and so there should be no user mappings
 > to worry about.
 > 
 > Hence, I believe it is safe to get rid of this - but this patch will
 > need some rigorous testing.  My ARM VersatilePB926 still boots without
 > this additional patch - but that's not a very good test.  I can't say
 > much more than that for the time being.
 > 
 > Note: for ARMv6 and later, flush_cache_page() is a no-op, so please
 > don't bother testing this patch there.
 > 
 > Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
 > ---
 >  arch/arm/mm/fault-armv.c |    2 --
 >  1 files changed, 0 insertions(+), 2 deletions(-)
 > 
 > diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
 > index 7296022..666a871 100644
 > --- a/arch/arm/mm/fault-armv.c
 > +++ b/arch/arm/mm/fault-armv.c
 > @@ -127,8 +127,6 @@ make_coherent(struct address_space *mapping, struct vm_area_struct *vma, unsigne
 >  	flush_dcache_mmap_unlock(mapping);
 >  	if (aliases)
 >  		adjust_pte(vma, addr);
 > -	else
 > -		flush_cache_page(vma, addr, pfn);
 >  }
 >  
 >  /*
 > 
 > _______________________________________________
 > linux-arm-kernel mailing list
 > linux-arm-kernel at lists.infradead.org
 > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

What's the status of this patch? I see that it's still not included
in the 2.6.34-rc1 kernel. Did it turn out to be invalid, or was it
just forgotten?

As I reported earlier, it sped up an important use case for me by 1%,
so I've been using it in my ARM kernels for almost 3 months now.

/Mikael



More information about the linux-arm-kernel mailing list