summaryrefslogtreecommitdiffstats
path: root/mm/mprotect.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mprotect.c')
-rw-r--r--mm/mprotect.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 88584838e704..e7d6f1171ecb 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -29,6 +29,8 @@
29#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
30#include <asm/tlbflush.h> 30#include <asm/tlbflush.h>
31 31
32#include "internal.h"
33
32/* 34/*
33 * For a prot_numa update we only hold mmap_sem for read so there is a 35 * For a prot_numa update we only hold mmap_sem for read so there is a
34 * potential race with faulting where a pmd was temporarily none. This 36 * potential race with faulting where a pmd was temporarily none. This
@@ -322,6 +324,15 @@ success:
322 change_protection(vma, start, end, vma->vm_page_prot, 324 change_protection(vma, start, end, vma->vm_page_prot,
323 dirty_accountable, 0); 325 dirty_accountable, 0);
324 326
327 /*
328 * Private VM_LOCKED VMA becoming writable: trigger COW to avoid major
329 * fault on access.
330 */
331 if ((oldflags & (VM_WRITE | VM_SHARED | VM_LOCKED)) == VM_LOCKED &&
332 (newflags & VM_WRITE)) {
333 populate_vma_page_range(vma, start, end, NULL);
334 }
335
325 vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); 336 vm_stat_account(mm, oldflags, vma->vm_file, -nrpages);
326 vm_stat_account(mm, newflags, vma->vm_file, nrpages); 337 vm_stat_account(mm, newflags, vma->vm_file, nrpages);
327 perf_event_mmap(vma); 338 perf_event_mmap(vma);