The patch titled Subject: mm/memory.c: remove pte_sw_mkyoung() has been added to the -mm tree. Its filename is mm-memoryc-remove-pte_sw_mkyoung.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-memoryc-remove-pte_sw_mkyoung.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-memoryc-remove-pte_sw_mkyoung.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Subject: mm/memory.c: remove pte_sw_mkyoung() Commit 83d116c53058 ("mm: fix double page fault on arm64 if PTE_AF is cleared") introduced arch_faults_on_old_pte() helper to identify platforms that don't set page access bit in HW and require a page fault to set it. Commit 44bf431b47b4 ("mm/memory.c: Add memory read privilege on page fault handling") added pte_sw_mkyoung() which is yet another way to manage platforms that don't set page access bit in HW and require a page fault to set it. Remove that pte_sw_mkyoung() helper and use the already existing arch_faults_on_old_pte() helper together with pte_mkyoung() instead. Link: https://lkml.kernel.org/r/f302ef92c48d1f08a0459aaee1c568ca11213814.1612345700.git.christophe.leroy@xxxxxxxxxx Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> Cc: Bibo Mao <maobibo@xxxxxxxxxxx> Cc: Jia He <justin.he@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/mips/include/asm/pgtable.h | 2 -- include/linux/pgtable.h | 16 ---------------- mm/memory.c | 9 ++++++--- 3 files changed, 6 insertions(+), 21 deletions(-) --- a/arch/mips/include/asm/pgtable.h~mm-memoryc-remove-pte_sw_mkyoung +++ a/arch/mips/include/asm/pgtable.h @@ -406,8 +406,6 @@ static inline pte_t pte_mkyoung(pte_t pt return pte; } -#define pte_sw_mkyoung pte_mkyoung - #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_HUGE; } --- a/include/linux/pgtable.h~mm-memoryc-remove-pte_sw_mkyoung +++ a/include/linux/pgtable.h @@ -424,22 +424,6 @@ static inline void ptep_set_wrprotect(st } #endif -/* - * On some architectures hardware does not set page access bit when accessing - * memory page, it is responsibilty of software setting this bit. It brings - * out extra page fault penalty to track page access bit. For optimization page - * access bit can be set during all page fault flow on these arches. - * To be differentiate with macro pte_mkyoung, this macro is used on platforms - * where software maintains page access bit. - */ -#ifndef pte_sw_mkyoung -static inline pte_t pte_sw_mkyoung(pte_t pte) -{ - return pte; -} -#define pte_sw_mkyoung pte_sw_mkyoung -#endif - #ifndef pte_savedwrite #define pte_savedwrite pte_write #endif --- a/mm/memory.c~mm-memoryc-remove-pte_sw_mkyoung +++ a/mm/memory.c @@ -2890,7 +2890,8 @@ static vm_fault_t wp_page_copy(struct vm } flush_cache_page(vma, vmf->address, pte_pfn(vmf->orig_pte)); entry = mk_pte(new_page, vma->vm_page_prot); - entry = pte_sw_mkyoung(entry); + if (arch_faults_on_old_pte()) + entry = pte_mkyoung(entry); entry = maybe_mkwrite(pte_mkdirty(entry), vma); /* @@ -3548,7 +3549,8 @@ static vm_fault_t do_anonymous_page(stru __SetPageUptodate(page); entry = mk_pte(page, vma->vm_page_prot); - entry = pte_sw_mkyoung(entry); + if (arch_faults_on_old_pte()) + entry = pte_mkyoung(entry); if (vma->vm_flags & VM_WRITE) entry = pte_mkwrite(pte_mkdirty(entry)); @@ -3824,7 +3826,8 @@ vm_fault_t alloc_set_pte(struct vm_fault flush_icache_page(vma, page); entry = mk_pte(page, vma->vm_page_prot); - entry = pte_sw_mkyoung(entry); + if (arch_faults_on_old_pte()) + entry = pte_mkyoung(entry); if (write) entry = maybe_mkwrite(pte_mkdirty(entry), vma); /* copy-on-write page */ _ Patches currently in -mm which might be from christophe.leroy@xxxxxxxxxx are mm-memoryc-remove-pte_sw_mkyoung.patch mm-remove-arch_remap-and-mm-arch-hooksh.patch