powerpc/64e: Fix wrong test in __ptep_test_and_clear_young()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 25 Sep 2023 18:31:16 +0000 (20:31 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 9 Oct 2023 11:37:31 +0000 (22:37 +1100)
Commit 45201c879469 ("powerpc/nohash: Remove hash related code from
nohash headers.") replaced:

  if ((pte_val(*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0)
return 0;

By:

  if (pte_young(*ptep))
return 0;

But it should be:

  if (!pte_young(*ptep))
return 0;

Fix it.

Fixes: 45201c879469 ("powerpc/nohash: Remove hash related code from nohash headers.")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/8bb7f06494e21adada724ede47a4c3d97e879d40.1695659959.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/nohash/64/pgtable.h

index 5cd9acf58a7db92945dab1dff92e90e9c0196821..eb6891e34cbde4ee5a2daf337b931e25d333a546 100644 (file)
@@ -197,7 +197,7 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
 {
        unsigned long old;
 
-       if (pte_young(*ptep))
+       if (!pte_young(*ptep))
                return 0;
        old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0, 0);
        return (old & _PAGE_ACCESSED) != 0;