]> Pileus Git - ~andy/linux/commitdiff
ARM: ZERO_PAGE: Avoid flush_dcache_page() for zero page
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 25 Oct 2009 10:23:04 +0000 (10:23 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 1 Dec 2009 18:20:07 +0000 (18:20 +0000)
The zero page is read-only, and has its cache state cleared during
boot.  No further maintanence for this page is required.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/fault-armv.c
arch/arm/mm/flush.c
arch/arm/mm/mmu.c

index d0d17b6a370304749d4f0f04c63662716e1c65e2..4fbc7de8b4acd199059579cbfd7449f81424a673 100644 (file)
@@ -151,7 +151,14 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
        if (!pfn_valid(pfn))
                return;
 
+       /*
+        * The zero page is never written to, so never has any dirty
+        * cache lines, and therefore never needs to be flushed.
+        */
        page = pfn_to_page(pfn);
+       if (page == ZERO_PAGE(0))
+               return;
+
        mapping = page_mapping(page);
 #ifndef CONFIG_SMP
        if (test_and_clear_bit(PG_dcache_dirty, &page->flags))
index 43474d8752a6bd4909a0fff9c7a68a656ac5f423..82f4b06bf6b4a39774ba43a3fb183fa5501404d2 100644 (file)
@@ -189,7 +189,16 @@ static void __flush_dcache_aliases(struct address_space *mapping, struct page *p
  */
 void flush_dcache_page(struct page *page)
 {
-       struct address_space *mapping = page_mapping(page);
+       struct address_space *mapping;
+
+       /*
+        * The zero page is never written to, so never has any dirty
+        * cache lines, and therefore never needs to be flushed.
+        */
+       if (page == ZERO_PAGE(0))
+               return;
+
+       mapping = page_mapping(page);
 
 #ifndef CONFIG_SMP
        if (!PageHighMem(page) && mapping && !mapping_mapped(mapping))
index ea67be0223ace255de0d96af02009fc5274085b0..2427cdcd9098141b919a578bb116414ffef423ef 100644 (file)
@@ -1036,7 +1036,7 @@ void __init paging_init(struct machine_desc *mdesc)
         */
        zero_page = alloc_bootmem_low_pages(PAGE_SIZE);
        empty_zero_page = virt_to_page(zero_page);
-       flush_dcache_page(empty_zero_page);
+       __flush_dcache_page(NULL, empty_zero_page);
 }
 
 /*