|
@@ -29,6 +29,8 @@
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/tlbflush.h>
|
|
|
|
|
|
|
|
+#include "internal.h"
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* For a prot_numa update we only hold mmap_sem for read so there is a
|
|
* For a prot_numa update we only hold mmap_sem for read so there is a
|
|
* potential race with faulting where a pmd was temporarily none. This
|
|
* potential race with faulting where a pmd was temporarily none. This
|
|
@@ -322,6 +324,15 @@ success:
|
|
change_protection(vma, start, end, vma->vm_page_prot,
|
|
change_protection(vma, start, end, vma->vm_page_prot,
|
|
dirty_accountable, 0);
|
|
dirty_accountable, 0);
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Private VM_LOCKED VMA becoming writable: trigger COW to avoid major
|
|
|
|
+ * fault on access.
|
|
|
|
+ */
|
|
|
|
+ if ((oldflags & (VM_WRITE | VM_SHARED | VM_LOCKED)) == VM_LOCKED &&
|
|
|
|
+ (newflags & VM_WRITE)) {
|
|
|
|
+ populate_vma_page_range(vma, start, end, NULL);
|
|
|
|
+ }
|
|
|
|
+
|
|
vm_stat_account(mm, oldflags, vma->vm_file, -nrpages);
|
|
vm_stat_account(mm, oldflags, vma->vm_file, -nrpages);
|
|
vm_stat_account(mm, newflags, vma->vm_file, nrpages);
|
|
vm_stat_account(mm, newflags, vma->vm_file, nrpages);
|
|
perf_event_mmap(vma);
|
|
perf_event_mmap(vma);
|