Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230724
b: refs/heads/master
c: 5ecfda0
h: refs/heads/master
v: v3
  • Loading branch information
Michel Lespinasse authored and Linus Torvalds committed Jan 14, 2011
1 parent a7d9ec7 commit b1c3fa1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 72ddc8f72270758951ccefb7d190f364d20215ab
refs/heads/master: 5ecfda041e4b4bd858d25bbf5a16c2a6c06d7272
7 changes: 6 additions & 1 deletion trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -3299,7 +3299,12 @@ int make_pages_present(unsigned long addr, unsigned long end)
vma = find_vma(current->mm, addr);
if (!vma)
return -ENOMEM;
write = (vma->vm_flags & VM_WRITE) != 0;
/*
* We want to touch writable mappings with a write fault in order
* to break COW, except for shared mappings because these don't COW
* and we would not want to dirty them for nothing.
*/
write = (vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE;
BUG_ON(addr >= end);
BUG_ON(end > vma->vm_end);
len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE;
Expand Down
7 changes: 6 additions & 1 deletion trunk/mm/mlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));

gup_flags = FOLL_TOUCH | FOLL_GET;
if (vma->vm_flags & VM_WRITE)
/*
* We want to touch writable mappings with a write fault in order
* to break COW, except for shared mappings because these don't COW
* and we would not want to dirty them for nothing.
*/
if ((vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE)
gup_flags |= FOLL_WRITE;

/* We don't try to access the guard page of a stack vma */
Expand Down

0 comments on commit b1c3fa1

Please sign in to comment.