aboutsummaryrefslogtreecommitdiffstats
path: root/mm/rmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/rmap.c')
-rw-r--r--mm/rmap.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index c3d6dc4223a4..eb3dfc8355ea 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -788,7 +788,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
788 ret = SWAP_MLOCK; 788 ret = SWAP_MLOCK;
789 goto out_unmap; 789 goto out_unmap;
790 } 790 }
791 if (MLOCK_PAGES && TTU_ACTION(flags) == TTU_MUNLOCK) 791 if (TTU_ACTION(flags) == TTU_MUNLOCK)
792 goto out_unmap; 792 goto out_unmap;
793 } 793 }
794 if (!(flags & TTU_IGNORE_ACCESS)) { 794 if (!(flags & TTU_IGNORE_ACCESS)) {
@@ -861,7 +861,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
861out_unmap: 861out_unmap:
862 pte_unmap_unlock(pte, ptl); 862 pte_unmap_unlock(pte, ptl);
863 863
864 if (MLOCK_PAGES && ret == SWAP_MLOCK) { 864 if (ret == SWAP_MLOCK) {
865 ret = SWAP_AGAIN; 865 ret = SWAP_AGAIN;
866 if (down_read_trylock(&vma->vm_mm->mmap_sem)) { 866 if (down_read_trylock(&vma->vm_mm->mmap_sem)) {
867 if (vma->vm_flags & VM_LOCKED) { 867 if (vma->vm_flags & VM_LOCKED) {
@@ -938,11 +938,10 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount,
938 return ret; 938 return ret;
939 939
940 /* 940 /*
941 * MLOCK_PAGES => feature is configured. 941 * If we can acquire the mmap_sem for read, and vma is VM_LOCKED,
942 * if we can acquire the mmap_sem for read, and vma is VM_LOCKED,
943 * keep the sem while scanning the cluster for mlocking pages. 942 * keep the sem while scanning the cluster for mlocking pages.
944 */ 943 */
945 if (MLOCK_PAGES && down_read_trylock(&vma->vm_mm->mmap_sem)) { 944 if (down_read_trylock(&vma->vm_mm->mmap_sem)) {
946 locked_vma = (vma->vm_flags & VM_LOCKED); 945 locked_vma = (vma->vm_flags & VM_LOCKED);
947 if (!locked_vma) 946 if (!locked_vma)
948 up_read(&vma->vm_mm->mmap_sem); /* don't need it */ 947 up_read(&vma->vm_mm->mmap_sem); /* don't need it */
@@ -1075,9 +1074,6 @@ static int try_to_unmap_file(struct page *page, enum ttu_flags flags)
1075 1074
1076 list_for_each_entry(vma, &mapping->i_mmap_nonlinear, 1075 list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
1077 shared.vm_set.list) { 1076 shared.vm_set.list) {
1078 if (!MLOCK_PAGES && !(flags & TTU_IGNORE_MLOCK) &&
1079 (vma->vm_flags & VM_LOCKED))
1080 continue;
1081 cursor = (unsigned long) vma->vm_private_data; 1077 cursor = (unsigned long) vma->vm_private_data;
1082 if (cursor > max_nl_cursor) 1078 if (cursor > max_nl_cursor)
1083 max_nl_cursor = cursor; 1079 max_nl_cursor = cursor;
@@ -1110,9 +1106,6 @@ static int try_to_unmap_file(struct page *page, enum ttu_flags flags)
1110 do { 1106 do {
1111 list_for_each_entry(vma, &mapping->i_mmap_nonlinear, 1107 list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
1112 shared.vm_set.list) { 1108 shared.vm_set.list) {
1113 if (!MLOCK_PAGES && !(flags & TTU_IGNORE_MLOCK) &&
1114 (vma->vm_flags & VM_LOCKED))
1115 continue;
1116 cursor = (unsigned long) vma->vm_private_data; 1109 cursor = (unsigned long) vma->vm_private_data;
1117 while ( cursor < max_nl_cursor && 1110 while ( cursor < max_nl_cursor &&
1118 cursor < vma->vm_end - vma->vm_start) { 1111 cursor < vma->vm_end - vma->vm_start) {