linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC 1/3] mm/ksm: add anonymous check in find_mergeable_vma
@ 2024-06-05  9:53 alexs
  2024-06-05  9:53 ` [RFC 2/3] mm/ksm: jump out early if vma out of date in cmp_and_merge_page alexs
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: alexs @ 2024-06-05  9:53 UTC (permalink / raw)
  To: Andrew Morton, linux-mm, linux-kernel, izik.eidus, willy,
	aarcange, chrisw, hughd, david
  Cc: Alex Shi (tencent)

From: "Alex Shi (tencent)" <alexs@kernel.org>

We do vma_set_anonyous in do_mmap(), and then vma_is_anonymous()
checking workable, use it as a extra check since ksm only care anonymous
pages.

Signed-off-by: Alex Shi (tencent) <alexs@kernel.org>
---
 mm/ksm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index f5138f43f0d2..088bce39cd33 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -742,7 +742,8 @@ static struct vm_area_struct *find_mergeable_vma(struct mm_struct *mm,
 	if (ksm_test_exit(mm))
 		return NULL;
 	vma = vma_lookup(mm, addr);
-	if (!vma || !(vma->vm_flags & VM_MERGEABLE) || !vma->anon_vma)
+	if (!vma || !(vma->vm_flags & VM_MERGEABLE) || !vma->anon_vma ||
+			!vma_is_anonymous(vma))
 		return NULL;
 	return vma;
 }
-- 
2.43.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-07 10:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05  9:53 [RFC 1/3] mm/ksm: add anonymous check in find_mergeable_vma alexs
2024-06-05  9:53 ` [RFC 2/3] mm/ksm: jump out early if vma out of date in cmp_and_merge_page alexs
2024-06-05  9:53 ` [RFC 3/3] mm/ksm: move flush_anon_page before checksum calculation alexs
2024-06-05 10:04   ` Alex Shi
     [not found] ` <353d4f6c-ed3d-4afe-82ab-8c0b22a0178f@redhat.com>
2024-06-07  9:33   ` [RFC 1/3] mm/ksm: add anonymous check in find_mergeable_vma Alex Shi
2024-06-07 10:13     ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox