From 67d075d23a8bcb411d505f6d517eb82d731442e7 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Mon, 18 Jan 2021 15:29:39 +0000 Subject: [PATCH] Revert "FROMGIT: mm: improve mprotect(R|W) efficiency on pages referenced once" This reverts commit 6f9aba5a20b84a20848cc444a304f4ada6538b39. Reason for revert: Breaks CTS Change-Id: I88ce3506b4881a7d8dae0aaf687dba602a0ca0ff Signed-off-by: Quentin Perret --- mm/mprotect.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mm/mprotect.c b/mm/mprotect.c index 380be7b59a0f..a2a62d62a8b5 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -47,8 +47,6 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, bool prot_numa = cp_flags & MM_CP_PROT_NUMA; bool uffd_wp = cp_flags & MM_CP_UFFD_WP; bool uffd_wp_resolve = cp_flags & MM_CP_UFFD_WP_RESOLVE; - bool anon_writable = - vma_is_anonymous(vma) && (vma->vm_flags & VM_WRITE); /* * Can be called with only the mmap_lock for reading by @@ -138,11 +136,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, (pte_soft_dirty(ptent) || !(vma->vm_flags & VM_SOFTDIRTY))) { ptent = pte_mkwrite(ptent); - } else if (anon_writable && - page_mapcount(pte_page(ptent)) == 1) { - ptent = pte_mkwrite(ptent); } - ptep_modify_prot_commit(vma, addr, pte, oldpte, ptent); pages++; } else if (is_swap_pte(oldpte)) {