• xu xin's avatar
    ksm: count all zero pages placed by KSM · e2942062
    xu xin authored
    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 ksm_zero_pages under /sys/kernel/mm/ksm/ to show the number
    of all zero pages placed by KSM. Meanwhile, we update the Documentation.
    
    Link: https://lkml.kernel.org/r/20230613030934.185944-1-yang.yang29@zte.com.cnSigned-off-by: default avatarxu xin <xu.xin16@zte.com.cn>
    Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
    Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Cc: Xuexin Jiang <jiang.xuexin@zte.com.cn>
    Reviewed-by: default avatarXiaokai Ran <ran.xiaokai@zte.com.cn>
    Reviewed-by: default avatarYang Yang <yang.yang29@zte.com.cn>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    e2942062
ksm.c 96.2 KB