Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176304
b: refs/heads/master
c: caed0f4
h: refs/heads/master
v: v3
  • Loading branch information
KOSAKI Motohiro authored and Linus Torvalds committed Dec 15, 2009
1 parent a012046 commit 976fc16
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 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: 23ce932a5e3ec3b9f06e92c8797d834d43abfb0f
refs/heads/master: caed0f486e582eeeb6e3546417fd758230fe4ad9
35 changes: 22 additions & 13 deletions trunk/mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,10 +789,9 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
* skipped over this mm) then we should reactivate it.
*/
if (!(flags & TTU_IGNORE_MLOCK)) {
if (vma->vm_flags & VM_LOCKED) {
ret = SWAP_MLOCK;
goto out_unmap;
}
if (vma->vm_flags & VM_LOCKED)
goto out_mlock;

if (TTU_ACTION(flags) == TTU_MUNLOCK)
goto out_unmap;
}
Expand Down Expand Up @@ -865,18 +864,28 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,

out_unmap:
pte_unmap_unlock(pte, ptl);
out:
return ret;

if (ret == SWAP_MLOCK) {
ret = SWAP_AGAIN;
if (down_read_trylock(&vma->vm_mm->mmap_sem)) {
if (vma->vm_flags & VM_LOCKED) {
mlock_vma_page(page);
ret = SWAP_MLOCK;
}
up_read(&vma->vm_mm->mmap_sem);
out_mlock:
pte_unmap_unlock(pte, ptl);


/*
* We need mmap_sem locking, Otherwise VM_LOCKED check makes
* unstable result and race. Plus, We can't wait here because
* we now hold anon_vma->lock or mapping->i_mmap_lock.
* if trylock failed, the page remain in evictable lru and later
* vmscan could retry to move the page to unevictable lru if the
* page is actually mlocked.
*/
if (down_read_trylock(&vma->vm_mm->mmap_sem)) {
if (vma->vm_flags & VM_LOCKED) {
mlock_vma_page(page);
ret = SWAP_MLOCK;
}
up_read(&vma->vm_mm->mmap_sem);
}
out:
return ret;
}

Expand Down

0 comments on commit 976fc16

Please sign in to comment.