aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2012-12-19 20:44:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 10:06:56 -0500
commitb6b19f25f69149c0912788fb81466dd2310bb095 (patch)
tree1b9a3e2c66b45ef7de48b58238874163b6090932 /mm
parent2832bc19f6668fd00116f61f821105040599ef8b (diff)
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>
Diffstat (limited to 'mm')
-rw-r--r--mm/ksm.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/ksm.c b/mm/ksm.c
index 82dfb4b54321..51573858938d 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1624,7 +1624,7 @@ again:
1624 struct anon_vma_chain *vmac; 1624 struct anon_vma_chain *vmac;
1625 struct vm_area_struct *vma; 1625 struct vm_area_struct *vma;
1626 1626
1627 anon_vma_lock_write(anon_vma); 1627 anon_vma_lock_read(anon_vma);
1628 anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, 1628 anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
1629 0, ULONG_MAX) { 1629 0, ULONG_MAX) {
1630 vma = vmac->vma; 1630 vma = vmac->vma;
@@ -1648,7 +1648,7 @@ again:
1648 if (!search_new_forks || !mapcount) 1648 if (!search_new_forks || !mapcount)
1649 break; 1649 break;
1650 } 1650 }
1651 anon_vma_unlock(anon_vma); 1651 anon_vma_unlock_read(anon_vma);
1652 if (!mapcount) 1652 if (!mapcount)
1653 goto out; 1653 goto out;
1654 } 1654 }
@@ -1678,7 +1678,7 @@ again:
1678 struct anon_vma_chain *vmac; 1678 struct anon_vma_chain *vmac;
1679 struct vm_area_struct *vma; 1679 struct vm_area_struct *vma;
1680 1680
1681 anon_vma_lock_write(anon_vma); 1681 anon_vma_lock_read(anon_vma);
1682 anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, 1682 anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
1683 0, ULONG_MAX) { 1683 0, ULONG_MAX) {
1684 vma = vmac->vma; 1684 vma = vmac->vma;
@@ -1697,11 +1697,11 @@ again:
1697 ret = try_to_unmap_one(page, vma, 1697 ret = try_to_unmap_one(page, vma,
1698 rmap_item->address, flags); 1698 rmap_item->address, flags);
1699 if (ret != SWAP_AGAIN || !page_mapped(page)) { 1699 if (ret != SWAP_AGAIN || !page_mapped(page)) {
1700 anon_vma_unlock(anon_vma); 1700 anon_vma_unlock_read(anon_vma);
1701 goto out; 1701 goto out;
1702 } 1702 }
1703 } 1703 }
1704 anon_vma_unlock(anon_vma); 1704 anon_vma_unlock_read(anon_vma);
1705 } 1705 }
1706 if (!search_new_forks++) 1706 if (!search_new_forks++)
1707 goto again; 1707 goto again;
@@ -1731,7 +1731,7 @@ again:
1731 struct anon_vma_chain *vmac; 1731 struct anon_vma_chain *vmac;
1732 struct vm_area_struct *vma; 1732 struct vm_area_struct *vma;
1733 1733
1734 anon_vma_lock_write(anon_vma); 1734 anon_vma_lock_read(anon_vma);
1735 anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, 1735 anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
1736 0, ULONG_MAX) { 1736 0, ULONG_MAX) {
1737 vma = vmac->vma; 1737 vma = vmac->vma;
@@ -1749,11 +1749,11 @@ again:
1749 1749
1750 ret = rmap_one(page, vma, rmap_item->address, arg); 1750 ret = rmap_one(page, vma, rmap_item->address, arg);
1751 if (ret != SWAP_AGAIN) { 1751 if (ret != SWAP_AGAIN) {
1752 anon_vma_unlock(anon_vma); 1752 anon_vma_unlock_read(anon_vma);
1753 goto out; 1753 goto out;
1754 } 1754 }
1755 } 1755 }
1756 anon_vma_unlock(anon_vma); 1756 anon_vma_unlock_read(anon_vma);
1757 } 1757 }
1758 if (!search_new_forks++) 1758 if (!search_new_forks++)
1759 goto again; 1759 goto again;