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 <[email protected]>
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 380be7b..a2a62d6 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)) {