Skip to contentSkip to conversation

ppc32: fix ptep_test_and_clear_young

PATCH New Benjamin Herrenschmidt 1 participant 1 message Feb 21, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc32: fix ptep_test_and_clear_young

Hi !

ppc32's implementation of ptep_test_and_clear_young() has a logic error which makes it fail to flush the hash table. Thus PAGE_ACCESSED is almost never set again after beeing cleared (unless something else cause that hash entry to be flushed).

include/asm-ppc/pgtable.h +2 -2
Index: linux-work/include/asm-ppc/pgtable.h
===================================================================
@@ -560,12 +560,12 @@
 static inline int ptep_test_and_clear_young(pte_t *ptep)
 {
 	unsigned long old;
-	old = (pte_update(ptep, _PAGE_ACCESSED, 0) & _PAGE_ACCESSED);
+	old = pte_update(ptep, _PAGE_ACCESSED, 0);
 #if _PAGE_HASHPTE != 0
 	if (old & _PAGE_HASHPTE)
 		flush_hash_one_pte(ptep);
 #endif
-	return old != 0;
+	return (old & _PAGE_ACCESSED) != 0;
 }
 
 static inline int ptep_test_and_clear_dirty(pte_t *ptep)