diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-06-25 09:29:17 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-07-23 06:05:40 -0400 |
commit | a6d64b9717782170ba27c16b6df8191169d92fad (patch) | |
tree | 5721ea5dd94e02e81e01a50a343b38fcb193f5d1 /litmus | |
parent | c85e6eae1698cecb15d63e112e937f706280c78e (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.
Diffstat (limited to 'litmus')
-rw-r--r-- | litmus/ctrldev.c | 13 |
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) |