[PATCH] mm: zap_pte_range dont dirty anon
authorHugh Dickins <hugh@veritas.com>
Sun, 30 Oct 2005 01:15:54 +0000 (18:15 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 30 Oct 2005 04:40:36 +0000 (21:40 -0700)
zap_pte_range already avoids wasting time to mark_page_accessed on anon pages:
it can also skip anon set_page_dirty - the page only needs to be marked dirty
if shared with another mm, but that will say pte_dirty too.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/memory.c

index 222c13e46130dc5dc62f22dc75dd3c788fa5394b..fd5d4c6dc762c83f0a3ce7b808824f38b40db6a2 100644 (file)
@@ -574,12 +574,14 @@ static void zap_pte_range(struct mmu_gather *tlb, pmd_t *pmd,
                                                addr) != page->index)
                                set_pte_at(tlb->mm, addr, pte,
                                           pgoff_to_pte(page->index));
-                       if (pte_dirty(ptent))
-                               set_page_dirty(page);
                        if (PageAnon(page))
                                dec_mm_counter(tlb->mm, anon_rss);
-                       else if (pte_young(ptent))
-                               mark_page_accessed(page);
+                       else {
+                               if (pte_dirty(ptent))
+                                       set_page_dirty(page);
+                               if (pte_young(ptent))
+                                       mark_page_accessed(page);
+                       }
                        tlb->freed++;
                        page_remove_rmap(page);
                        tlb_remove_page(tlb, page);