From e6487e273e11223e040d8dfc21ac5883bfc78204 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Mon, 18 Jan 2021 16:25:49 +0000 Subject: [PATCH] Revert "BACKPORT: FROMGIT: mm: improve mprotect(R|W) efficiency on pages referenced once" This reverts commit 6c376abc0176a673548d8bd87f327c0a24cc562b. Reason for revert: Breaks CTS Change-Id: I606cda34b58abb44d2f2bfc085a644dcf8ea7a25 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 6d2568b42c1d..5c175d46d4cb 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -44,8 +44,6 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, spinlock_t *ptl; unsigned long pages = 0; int target_node = NUMA_NO_NODE; - bool anon_writable = - vma_is_anonymous(vma) && (vma->vm_flags & VM_WRITE); /* * Can be called with only the mmap_sem for reading by @@ -122,11 +120,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(mm, addr, pte, ptent); pages++; } else if (IS_ENABLED(CONFIG_MIGRATION)) {