Skip to content

Commit

Permalink
ksm: fix ksm swapin time optimization
Browse files Browse the repository at this point in the history
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 <aarcange@redhat.com>
Signed-off-by: Rik van Riel <riel@redhat.com>
Cc: Izik Eidus <ieidus@yahoo.com>
Cc: Avi Kivity <avi@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andrea Arcangeli authored and Linus Torvalds committed Aug 10, 2010
1 parent 26ba0cb commit ba6f0ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/ksm.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static inline struct page *ksm_might_need_to_copy(struct page *page,
struct anon_vma *anon_vma = page_anon_vma(page);

if (!anon_vma ||
(anon_vma == vma->anon_vma &&
(anon_vma->root == vma->anon_vma->root &&
page->index == linear_page_index(vma, address)))
return page;

Expand Down

0 comments on commit ba6f0ff

Please sign in to comment.