LWN.net Logo

rmap 24 pte_young first

From:  Hugh Dickins <hugh@veritas.com>
To:  Andrew Morton <akpm@osdl.org>
Subject:  [PATCH] rmap 24 pte_young first
Date:  Sat, 8 May 2004 22:56:26 +0100 (BST)
Cc:  Andrea Arcangeli <andrea@suse.de>, <linux-kernel@vger.kernel.org>

From: Andrea Arcangeli <andrea@suse.de>

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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds