mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
ksm: make rmap walks more scalable
The rmap walks in ksm.c are like those in rmap.c: they can safely be done with anon_vma_lock_read(). Signed-off-by: Hugh Dickins <hughd@google.com> Acked-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2832bc19f6
commit
b6b19f25f6
1 changed files with 8 additions and 8 deletions
16
mm/ksm.c
16
mm/ksm.c
|
@ -1624,7 +1624,7 @@ again:
|
||||||
struct anon_vma_chain *vmac;
|
struct anon_vma_chain *vmac;
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
|
|
||||||
anon_vma_lock_write(anon_vma);
|
anon_vma_lock_read(anon_vma);
|
||||||
anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
|
anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
|
||||||
0, ULONG_MAX) {
|
0, ULONG_MAX) {
|
||||||
vma = vmac->vma;
|
vma = vmac->vma;
|
||||||
|
@ -1648,7 +1648,7 @@ again:
|
||||||
if (!search_new_forks || !mapcount)
|
if (!search_new_forks || !mapcount)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
anon_vma_unlock(anon_vma);
|
anon_vma_unlock_read(anon_vma);
|
||||||
if (!mapcount)
|
if (!mapcount)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1678,7 +1678,7 @@ again:
|
||||||
struct anon_vma_chain *vmac;
|
struct anon_vma_chain *vmac;
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
|
|
||||||
anon_vma_lock_write(anon_vma);
|
anon_vma_lock_read(anon_vma);
|
||||||
anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
|
anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
|
||||||
0, ULONG_MAX) {
|
0, ULONG_MAX) {
|
||||||
vma = vmac->vma;
|
vma = vmac->vma;
|
||||||
|
@ -1697,11 +1697,11 @@ again:
|
||||||
ret = try_to_unmap_one(page, vma,
|
ret = try_to_unmap_one(page, vma,
|
||||||
rmap_item->address, flags);
|
rmap_item->address, flags);
|
||||||
if (ret != SWAP_AGAIN || !page_mapped(page)) {
|
if (ret != SWAP_AGAIN || !page_mapped(page)) {
|
||||||
anon_vma_unlock(anon_vma);
|
anon_vma_unlock_read(anon_vma);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
anon_vma_unlock(anon_vma);
|
anon_vma_unlock_read(anon_vma);
|
||||||
}
|
}
|
||||||
if (!search_new_forks++)
|
if (!search_new_forks++)
|
||||||
goto again;
|
goto again;
|
||||||
|
@ -1731,7 +1731,7 @@ again:
|
||||||
struct anon_vma_chain *vmac;
|
struct anon_vma_chain *vmac;
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
|
|
||||||
anon_vma_lock_write(anon_vma);
|
anon_vma_lock_read(anon_vma);
|
||||||
anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
|
anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
|
||||||
0, ULONG_MAX) {
|
0, ULONG_MAX) {
|
||||||
vma = vmac->vma;
|
vma = vmac->vma;
|
||||||
|
@ -1749,11 +1749,11 @@ again:
|
||||||
|
|
||||||
ret = rmap_one(page, vma, rmap_item->address, arg);
|
ret = rmap_one(page, vma, rmap_item->address, arg);
|
||||||
if (ret != SWAP_AGAIN) {
|
if (ret != SWAP_AGAIN) {
|
||||||
anon_vma_unlock(anon_vma);
|
anon_vma_unlock_read(anon_vma);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
anon_vma_unlock(anon_vma);
|
anon_vma_unlock_read(anon_vma);
|
||||||
}
|
}
|
||||||
if (!search_new_forks++)
|
if (!search_new_forks++)
|
||||||
goto again;
|
goto again;
|
||||||
|
|
Loading…
Reference in a new issue