[PATCH] rmap 24 pte_young first

From: Hugh Dickins
Date: Sat May 08 2004 - 16:58:39 EST


From: Andrea Arcangeli <andrea@xxxxxxx>

rmap test pte_young before doing the costlier ptep_test_and_clear_young.

rmap.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

--- rmap24/mm/rmap.c 2004-05-08 20:54:32.421571016 +0100
+++ rmap25/mm/rmap.c 2004-05-08 20:54:43.358908288 +0100
@@ -198,7 +198,7 @@ static int page_referenced_one(struct pa
if (page_to_pfn(page) != pte_pfn(*pte))
goto out_unmap;

- if (ptep_test_and_clear_young(pte))
+ if (pte_young(*pte) && ptep_test_and_clear_young(pte))
referenced++;

(*mapcount)--;
@@ -506,7 +506,7 @@ static int try_to_unmap_one(struct page
* skipped over this mm) then we should reactivate it.
*/
if ((vma->vm_flags & (VM_LOCKED|VM_RESERVED)) ||
- ptep_test_and_clear_young(pte)) {
+ (pte_young(*pte) && ptep_test_and_clear_young(pte))) {
ret = SWAP_FAIL;
goto out_unmap;
}
@@ -606,7 +606,7 @@ static int try_to_unmap_cluster(struct m
if (PageReserved(page))
continue;

- if (ptep_test_and_clear_young(pte))
+ if (pte_young(*pte) && ptep_test_and_clear_young(pte))
continue;

/* Nuke the page table entry. */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/