tree d3660490ac539970b875a49c9032c5c946282cbf
parent a4e884a311893b476893739901bed382cd62b4fe
author David S. Miller <[EMAIL PROTECTED]> Mon, 18 Apr 2005 08:03:09 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Mon, 18 Apr 2005 08:03:09 -0700

[PATCH] sparc64: Do not flush dcache for ZERO_PAGE.

This case actually can get exercised a lot during an ELF
coredump of a process which contains a lot of non-COW'd
anonymous pages.  GDB has this test case which in partiaular
creates near terabyte process full of ZERO_PAGEes.  It takes
forever to just walk through the page tables because of
all of these spurious cache flushes on sparc64.

With this change it takes only a second or so.

Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 sparc64/mm/init.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

Index: arch/sparc64/mm/init.c
===================================================================
--- 7b7b52678b61dfdf8e3a16b0e920d1e9b0cae979/arch/sparc64/mm/init.c  
(mode:100644 sha1:89022ccaa75bbc722a8a26477f1bb2a086df719a)
+++ d3660490ac539970b875a49c9032c5c946282cbf/arch/sparc64/mm/init.c  
(mode:100644 sha1:db6fa77b4dab67463c14c43da29fd5ee3284abf2)
@@ -201,13 +201,24 @@
 
 void flush_dcache_page(struct page *page)
 {
-       struct address_space *mapping = page_mapping(page);
-       int dirty = test_bit(PG_dcache_dirty, &page->flags);
-       int dirty_cpu = dcache_dirty_cpu(page);
-       int this_cpu = get_cpu();
+       struct address_space *mapping;
+       int this_cpu;
 
+       /* Do not bother with the expensive D-cache flush if it
+        * is merely the zero page.  The 'bigcore' testcase in GDB
+        * causes this case to run millions of times.
+        */
+       if (page == ZERO_PAGE(0))
+               return;
+
+       this_cpu = get_cpu();
+
+       mapping = page_mapping(page);
        if (mapping && !mapping_mapped(mapping)) {
+               int dirty = test_bit(PG_dcache_dirty, &page->flags);
                if (dirty) {
+                       int dirty_cpu = dcache_dirty_cpu(page);
+
                        if (dirty_cpu == this_cpu)
                                goto out;
                        smp_flush_dcache_page_impl(page, dirty_cpu);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to