]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ksm: count all zero pages placed by KSM
authorxu xin <xu.xin16@zte.com.cn>
Fri, 30 Dec 2022 01:15:14 +0000 (09:15 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 10 Feb 2023 23:36:02 +0000 (15:36 -0800)
commit1b9a09a288d59a77d94f833641181c90f60f7319
tree05aad09b4324a115f5b59554583842f3a3cd2f25
parentabf167f8986546aa0d390fbc2bc883f26425c44a
ksm: count all zero pages placed by KSM

As pages_sharing and pages_shared don't include the number of zero pages
merged by KSM, we cannot know how many pages are zero pages placed by KSM
when enabling use_zero_pages, which leads to KSM not being transparent
with all actual merged pages by KSM.  In the early days of use_zero_pages,
zero-pages was unable to get unshared by the ways like MADV_UNMERGEABLE so
it's hard to count how many times one of those zeropages was then
unmerged.

But now, unsharing KSM-placed zero page accurately has been achieved, so
we can easily count both how many times a page full of zeroes was merged
with zero-page and how many times one of those pages was then unmerged.
and so, it helps to estimate memory demands when each and every shared
page could get unshared.

So we add zero_pages_sharing under /sys/kernel/mm/ksm/ to show the number
of all zero pages placed by KSM.

Link: https://lkml.kernel.org/r/202212300915147801864@zte.com.cn
Signed-off-by: xu xin <xu.xin16@zte.com.cn>
Reviewed-by: Xiaokai Ran <ran.xiaokai@zte.com.cn>
Reviewed-by: Yang Yang <yang.yang29@zte.com.cn>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Xuexin Jiang <jiang.xuexin@zte.com.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/ksm.c