[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240605095304.66389-1-alexs@kernel.org>
Date: Wed, 5 Jun 2024 17:53:01 +0800
From: alexs@...nel.org
To: Andrew Morton <akpm@...ux-foundation.org>,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
izik.eidus@...ellosystems.com,
willy@...radead.org,
aarcange@...hat.com,
chrisw@...s-sol.org,
hughd@...gle.com,
david@...hat.com
Cc: "Alex Shi (tencent)" <alexs@...nel.org>
Subject: [RFC 1/3] mm/ksm: add anonymous check in find_mergeable_vma
From: "Alex Shi (tencent)" <alexs@...nel.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@...nel.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
Powered by blists - more mailing lists