Revert "FROMGIT: mm: improve mprotect(R|W) efficiency on pages referenced once"

This reverts commit 6f9aba5a20.

Reason for revert: Breaks CTS

Change-Id: I88ce3506b4881a7d8dae0aaf687dba602a0ca0ff
Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
Quentin Perret 2021-01-18 15:29:39 +00:00
parent a478ce01c2
commit 67d075d23a

View File

@ -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)) {