提交 b6b19f25 编写于 作者: H Hugh Dickins 提交者: Linus Torvalds

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: NHugh Dickins <hughd@google.com>
Acked-by: NMel Gorman <mgorman@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 2832bc19
......@@ -1624,7 +1624,7 @@ int page_referenced_ksm(struct page *page, struct mem_cgroup *memcg,
struct anon_vma_chain *vmac;
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,
0, ULONG_MAX) {
vma = vmac->vma;
......@@ -1648,7 +1648,7 @@ int page_referenced_ksm(struct page *page, struct mem_cgroup *memcg,
if (!search_new_forks || !mapcount)
break;
}
anon_vma_unlock(anon_vma);
anon_vma_unlock_read(anon_vma);
if (!mapcount)
goto out;
}
......@@ -1678,7 +1678,7 @@ int try_to_unmap_ksm(struct page *page, enum ttu_flags flags)
struct anon_vma_chain *vmac;
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,
0, ULONG_MAX) {
vma = vmac->vma;
......@@ -1697,11 +1697,11 @@ int try_to_unmap_ksm(struct page *page, enum ttu_flags flags)
ret = try_to_unmap_one(page, vma,
rmap_item->address, flags);
if (ret != SWAP_AGAIN || !page_mapped(page)) {
anon_vma_unlock(anon_vma);
anon_vma_unlock_read(anon_vma);
goto out;
}
}
anon_vma_unlock(anon_vma);
anon_vma_unlock_read(anon_vma);
}
if (!search_new_forks++)
goto again;
......@@ -1731,7 +1731,7 @@ int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *,
struct anon_vma_chain *vmac;
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,
0, ULONG_MAX) {
vma = vmac->vma;
......@@ -1749,11 +1749,11 @@ int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *,
ret = rmap_one(page, vma, rmap_item->address, arg);
if (ret != SWAP_AGAIN) {
anon_vma_unlock(anon_vma);
anon_vma_unlock_read(anon_vma);
goto out;
}
}
anon_vma_unlock(anon_vma);
anon_vma_unlock_read(anon_vma);
}
if (!search_new_forks++)
goto again;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册