mm: add dummy pmd_young() for architectures not having it
authorJuergen Gross <jgross@suse.com>
Wed, 30 Nov 2022 22:49:41 +0000 (14:49 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 30 Nov 2022 22:49:41 +0000 (14:49 -0800)
In order to avoid #ifdeffery add a dummy pmd_young() implementation as a
fallback.  This is required for the later patch "mm: introduce
arch_has_hw_nonleaf_pmd_young()".

Link: https://lkml.kernel.org/r/fd3ac3cd-7349-6bbd-890a-71a9454ca0b3@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Yu Zhao <yuzhao@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Sander Eikelenboom <linux@eikelenboom.it>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/loongarch/include/asm/pgtable.h
arch/mips/include/asm/pgtable.h
arch/riscv/include/asm/pgtable.h
arch/s390/include/asm/pgtable.h
arch/sparc/include/asm/pgtable_64.h
arch/x86/include/asm/pgtable.h
include/linux/pgtable.h

index 946704bee599ee843c9abc154355683550b1c6e0..10e0bd9009e2453d70e5f02f1f2f2bda47f60f09 100644 (file)
@@ -482,6 +482,7 @@ static inline pmd_t pmd_mkdirty(pmd_t pmd)
        return pmd;
 }
 
+#define pmd_young pmd_young
 static inline int pmd_young(pmd_t pmd)
 {
        return !!(pmd_val(pmd) & _PAGE_ACCESSED);
index 6caec386ad2f6861566588dc3a3b0a5570fe84a8..4678627673dfea0ef7369382cd8021229ebc52d4 100644 (file)
@@ -622,6 +622,7 @@ static inline pmd_t pmd_mkdirty(pmd_t pmd)
        return pmd;
 }
 
+#define pmd_young pmd_young
 static inline int pmd_young(pmd_t pmd)
 {
        return !!(pmd_val(pmd) & _PAGE_ACCESSED);
index 7ec936910a96e12d1994ceb2719eb98a2b0820d3..92ec2d9d7273f450a03d17ce7682d9b6f7d5c240 100644 (file)
@@ -600,6 +600,7 @@ static inline int pmd_dirty(pmd_t pmd)
        return pte_dirty(pmd_pte(pmd));
 }
 
+#define pmd_young pmd_young
 static inline int pmd_young(pmd_t pmd)
 {
        return pte_young(pmd_pte(pmd));
index f1cb9391190db93f051602be1ac3834492fe5278..11e901286414c5bc6e941d8d8d3972690fa576e6 100644 (file)
@@ -763,6 +763,7 @@ static inline int pmd_dirty(pmd_t pmd)
        return (pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY) != 0;
 }
 
+#define pmd_young pmd_young
 static inline int pmd_young(pmd_t pmd)
 {
        return (pmd_val(pmd) & _SEGMENT_ENTRY_YOUNG) != 0;
index a779418ceba9c098dc31e466037e414616c6a51e..3bc9736bddb1617b4cd06b160c0213d69deef003 100644 (file)
@@ -693,6 +693,7 @@ static inline unsigned long pmd_dirty(pmd_t pmd)
        return pte_dirty(pte);
 }
 
+#define pmd_young pmd_young
 static inline unsigned long pmd_young(pmd_t pmd)
 {
        pte_t pte = __pte(pmd_val(pmd));
index 5059799bebe36d4b3a2c34d5aeda8b35a92ca96d..1d55af8d82b96c57b4c6898f18592d22f1b8cf3a 100644 (file)
@@ -139,6 +139,7 @@ static inline int pmd_dirty(pmd_t pmd)
        return pmd_flags(pmd) & _PAGE_DIRTY;
 }
 
+#define pmd_young pmd_young
 static inline int pmd_young(pmd_t pmd)
 {
        return pmd_flags(pmd) & _PAGE_ACCESSED;
index a108b60a6962b343d5569b05388d6e8d5af14254..6b0d59269b33d72a5b21f81502bf02a92b43409d 100644 (file)
@@ -165,6 +165,13 @@ static inline pte_t *virt_to_kpte(unsigned long vaddr)
        return pmd_none(*pmd) ? NULL : pte_offset_kernel(pmd, vaddr);
 }
 
+#ifndef pmd_young
+static inline int pmd_young(pmd_t pmd)
+{
+       return 0;
+}
+#endif
+
 #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
 extern int ptep_set_access_flags(struct vm_area_struct *vma,
                                 unsigned long address, pte_t *ptep,