提交 ad12695f 编写于 作者: A Andrea Arcangeli 提交者: Linus Torvalds

ksm: add cond_resched() to the rmap_walks

While at it add it to the file and anon walks too.
Signed-off-by: NAndrea Arcangeli <aarcange@redhat.com>
Acked-by: NHugh Dickins <hughd@google.com>
Cc: Petr Holasek <pholasek@redhat.com>
Acked-by: NDavidlohr Bueso <dbueso@suse.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 df406551
...@@ -1914,9 +1914,11 @@ int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc) ...@@ -1914,9 +1914,11 @@ int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc)
struct anon_vma_chain *vmac; struct anon_vma_chain *vmac;
struct vm_area_struct *vma; struct vm_area_struct *vma;
cond_resched();
anon_vma_lock_read(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) {
cond_resched();
vma = vmac->vma; vma = vmac->vma;
if (rmap_item->address < vma->vm_start || if (rmap_item->address < vma->vm_start ||
rmap_item->address >= vma->vm_end) rmap_item->address >= vma->vm_end)
......
...@@ -1609,6 +1609,8 @@ static int rmap_walk_anon(struct page *page, struct rmap_walk_control *rwc) ...@@ -1609,6 +1609,8 @@ static int rmap_walk_anon(struct page *page, struct rmap_walk_control *rwc)
struct vm_area_struct *vma = avc->vma; struct vm_area_struct *vma = avc->vma;
unsigned long address = vma_address(page, vma); unsigned long address = vma_address(page, vma);
cond_resched();
if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg)) if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg))
continue; continue;
...@@ -1658,6 +1660,8 @@ static int rmap_walk_file(struct page *page, struct rmap_walk_control *rwc) ...@@ -1658,6 +1660,8 @@ static int rmap_walk_file(struct page *page, struct rmap_walk_control *rwc)
vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) { vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {
unsigned long address = vma_address(page, vma); unsigned long address = vma_address(page, vma);
cond_resched();
if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg)) if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg))
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册