linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [CFT:PATCH] Remove a seemingly unnecessary cache flush
Date: Mon, 7 Dec 2009 22:12:10 +0000	[thread overview]
Message-ID: <20091207221210.GI26821@n2100.arm.linux.org.uk> (raw)

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@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);
 }
 
 /*

             reply	other threads:[~2009-12-07 22:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07 22:12 Russell King - ARM Linux [this message]
2009-12-10 10:40 ` [CFT:PATCH] Remove a seemingly unnecessary cache flush Russell King - ARM Linux
2009-12-14 11:50   ` Mikael Pettersson
2009-12-14 11:53     ` Russell King - ARM Linux
2009-12-14 12:15       ` Mikael Pettersson
2009-12-20 19:32         ` Mikael Pettersson
2009-12-10 16:04 ` Mike Rapoport
2009-12-18 16:09 ` Russell King - ARM Linux
2010-03-09 15:46 ` Mikael Pettersson
2010-03-09 17:20   ` Russell King - ARM Linux
2010-03-09 19:15     ` Mikael Pettersson
     [not found] <20091207203258.GH26821@n2100.arm.linux.org.uk>
2009-12-08 13:26 ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091207221210.GI26821@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).