The patch titled ksm: fix ksm swapin time optimization has been added to the -mm tree. Its filename is ksm-fix-ksm-swapin-time-optimization.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: ksm: fix ksm swapin time optimization From: Andrea Arcangeli <aarcange@xxxxxxxxxx> 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@xxxxxxxxxx> Signed-off-by: Rik van Riel <riel@xxxxxxxxxx> Cc: Izik Eidus <ieidus@xxxxxxxxx> Cc: Avi Kivity <avi@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/ksm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN include/linux/ksm.h~ksm-fix-ksm-swapin-time-optimization include/linux/ksm.h --- a/include/linux/ksm.h~ksm-fix-ksm-swapin-time-optimization +++ a/include/linux/ksm.h @@ -78,7 +78,7 @@ static inline struct page *ksm_might_nee 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; _ Patches currently in -mm which might be from aarcange@xxxxxxxxxx are linux-next.patch hugetlb-call-mmu-notifiers-on-hugepage-cow.patch define-madv_hugepage.patch mmap-remove-unnecessary-lock-from-__vma_link.patch rmap-always-add-new-vmas-at-the-end.patch ksm-fix-ksm-swapin-time-optimization.patch rmap-always-use-anon_vma-root-pointer.patch rmap-resurrect-page_address_in_vma-anon_vma-check.patch add-anon_vma-bug-checks.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html