aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2012-06-25 09:29:17 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2012-07-23 06:05:40 -0400
commita6d64b9717782170ba27c16b6df8191169d92fad (patch)
tree5721ea5dd94e02e81e01a50a343b38fcb193f5d1
parentc85e6eae1698cecb15d63e112e937f706280c78e (diff)
control page: avoid "minor" page faults
By default, even private writable pages are mapped with the RW bit disabled in the PTE. This causes a "minor" page fault when the page is first written to. To avoid this, make sure that vm_inert_page() uses the proper page protection bits and mark the VMA as VM_IO to keep the rest of the VM code out.
-rw-r--r--litmus/ctrldev.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/litmus/ctrldev.c b/litmus/ctrldev.c
index ec0fc4b1ab55..9969ab17c190 100644
--- a/litmus/ctrldev.c
+++ b/litmus/ctrldev.c
@@ -95,9 +95,16 @@ static int litmus_ctrl_mmap(struct file* filp, struct vm_area_struct* vma)
95 return -EINVAL; 95 return -EINVAL;
96 96
97 vma->vm_ops = &litmus_ctrl_vm_ops; 97 vma->vm_ops = &litmus_ctrl_vm_ops;
98 /* this mapping should not be kept across forks, 98 /* This mapping should not be kept across forks,
99 * and cannot be expanded */ 99 * cannot be expanded, and is not a "normal" page. */
100 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; 100 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_IO;
101
102 /* We don't want the first write access to trigger a "minor" page fault
103 * to mark the page as dirty. This is transient, private memory, we
104 * don't care if it was touched or not. __S011 means RW access, but not
105 * execute, and avoids copy-on-write behavior.
106 * See protection_map in mmap.c. */
107 vma->vm_page_prot = __S011;
101 108
102 err = alloc_ctrl_page(current); 109 err = alloc_ctrl_page(current);
103 if (!err) 110 if (!err)