arm64: Do not flush the D-cache for anonymous pages
authorCatalin Marinas <catalin.marinas@arm.com>
Wed, 1 May 2013 15:34:22 +0000 (16:34 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 7 Jun 2013 16:58:29 +0000 (17:58 +0100)
The D-cache on AArch64 is VIPT non-aliasing, so there is no need to
flush it for anonymous pages.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Will Deacon <will.deacon@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
arch/arm64/mm/flush.c
arch/arm64/mm/mmu.c

index b9cd7a4deeca67d7e201bd8bd137478aad36525d..7c716634a671289b9a2c860f5c4a116b3167e679 100644 (file)
@@ -77,14 +77,12 @@ void __flush_dcache_page(struct page *page)
 
 void __sync_icache_dcache(pte_t pte, unsigned long addr)
 {
-       unsigned long pfn;
-       struct page *page;
+       struct page *page = pte_page(pte);
 
-       pfn = pte_pfn(pte);
-       if (!pfn_valid(pfn))
+       /* no flushing needed for anonymous pages */
+       if (!page_mapping(page))
                return;
 
-       page = pfn_to_page(pfn);
        if (!test_and_set_bit(PG_dcache_clean, &page->flags)) {
                __flush_dcache_page(page);
                __flush_icache_all();
index eeecc9c8ed6860accacc36bb5f5aa0e6c7db7e58..80a369eab637cb2abed1fa3ba653c971747f288e 100644 (file)
@@ -339,7 +339,6 @@ void __init paging_init(void)
        bootmem_init();
 
        empty_zero_page = virt_to_page(zero_page);
-       __flush_dcache_page(empty_zero_page);
 
        /*
         * TTBR0 is only used for the identity mapping at this stage. Make it