From 475c87f9adbbc8626a05025fbb48db980449e1f4 Mon Sep 17 00:00:00 2001 From: Rich Wiley Date: Fri, 21 Mar 2014 16:29:31 -0700 Subject: mm: mprotect: prevent unneeded TLB flushes from mprotect syscall change_protection_range will only flush the tlb if change_pte_range reports that it has actually changed the permissions of at least one page. This patch prevents change_pte_range from counting pages that it doesn't actually modify. Change-Id: I53b9b2c7a635ba1395200b9ff70f6f40a053f987 Signed-off-by: Rich Wiley Reviewed-on: http://git-master/r/385239 Reviewed-by: Alexander Van Brunt --- mm/mprotect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mm') diff --git a/mm/mprotect.c b/mm/mprotect.c index 6b2403a2f814..8d56d3933283 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -57,8 +57,10 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, ptent = ptep_modify_prot_start(mm, addr, pte); if (!prot_numa) { + pte_t old_ptent = ptent; ptent = pte_modify(ptent, newprot); - updated = true; + if (ptent != old_ptent) + updated = true; } else { struct page *page; -- cgit v1.2.3