From ba6f0ff3981e6263ab81ac512f04cca55b85ec81 Mon Sep 17 00:00:00 2001 From: Andrea Arcangeli Date: Mon, 9 Aug 2010 17:19:08 -0700 Subject: [PATCH] ksm: fix ksm swapin time optimization The new anon-vma code, was suboptimal and it lead to erratic invocation of ksm_does_need_to_copy. That leads to host hangs or guest vnc lockup, or weird behavior. It's unclear why ksm_does_need_to_copy is unstable but the point is that when KSM is not in use, ksm_does_need_to_copy must never run or we bounce pages for no good reason. I suspect the same hangs will happen with KVM swaps. But this at least fixes the regression in the new-anon-vma code and it only let KSM bugs triggers when KSM is in use. The code in do_swap_page likely doesn't cope well with a not-swapcache, especially the memcg code. Signed-off-by: Andrea Arcangeli Signed-off-by: Rik van Riel Cc: Izik Eidus Cc: Avi Kivity Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-format-patch failed