ksm: cond_resched in unstable tree
authorHugh Dickins <hugh.dickins@tiscali.co.uk>
Mon, 9 Nov 2009 15:58:23 +0000 (15:58 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 9 Nov 2009 17:55:44 +0000 (09:55 -0800)
KSM needs a cond_resched() for CONFIG_PREEMPT_NONE, in its unbounded
search of the unstable tree.  The stable tree cases already have one,
and originally there was one down inside get_user_pages();
but I missed it when I converted to follow_page() instead.

Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Acked-by: Izik Eidus <ieidus@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/ksm.c

index bef1af4f77e36186503c9fe2f91530954a456f3f..5575f8628fef5306611055092e47ed9f472f4027 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1012,6 +1012,7 @@ static struct rmap_item *unstable_tree_search_insert(struct page *page,
                struct rmap_item *tree_rmap_item;
                int ret;
 
+               cond_resched();
                tree_rmap_item = rb_entry(*new, struct rmap_item, node);
                page2[0] = get_mergeable_page(tree_rmap_item);
                if (!page2[0])