summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorRich Wiley <rwiley@nvidia.com>2014-03-21 16:29:31 -0700
committerAlexander Van Brunt <avanbrunt@nvidia.com>2014-03-25 15:02:18 -0700
commit475c87f9adbbc8626a05025fbb48db980449e1f4 (patch)
treea30d99a818dfeb3531c5a08a685f5a223dc8c30c /mm
parentea6fde84113493f627772f052fbf27d67a4a8c18 (diff)
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 <rwiley@nvidia.com> Reviewed-on: http://git-master/r/385239 Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/mprotect.c4
1 files changed, 3 insertions, 1 deletions
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;