--- a/mm/ksm.c~mm-ksm-use-vma_lookup-in-find_mergeable_vma +++ a/mm/ksm.c @@ -521,10 +521,8 @@ static struct vm_area_struct *find_merge struct vm_area_struct *vma; if (ksm_test_exit(mm)) return NULL; - vma = find_vma(mm, addr); - if (!vma || vma->vm_start > addr) - return NULL; - if (!(vma->vm_flags & VM_MERGEABLE) || !vma->anon_vma) + vma = vma_lookup(mm, addr); + if (!vma || !(vma->vm_flags & VM_MERGEABLE) || !vma->anon_vma) return NULL; return vma; }