lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Jan 2023 15:30:18 +0100
From:   David Hildenbrand <david@...hat.com>
To:     yang.yang29@....com.cn, akpm@...ux-foundation.org
Cc:     imbrenda@...ux.ibm.com, jiang.xuexin@....com.cn,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        ran.xiaokai@....com.cn, xu.xin.sc@...il.com, xu.xin16@....com.cn
Subject: Re: [PATCH v5 3/6] ksm: count all zero pages placed by KSM

On 30.12.22 02:15, yang.yang29@....com.cn wrote:
> From: xu xin <xu.xin16@....com.cn>
> 
> 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.
> 
> Signed-off-by: xu xin <xu.xin16@....com.cn>
> Cc: Claudio Imbrenda <imbrenda@...ux.ibm.com>
> Cc: David Hildenbrand <david@...hat.com>
> Cc: Xuexin Jiang <jiang.xuexin@....com.cn>
> Reviewed-by: Xiaokai Ran <ran.xiaokai@....com.cn>
> Reviewed-by: Yang Yang <yang.yang29@....com.cn>
> 
>   v4->v5:
>   fix warning  mm/ksm.c:3238:9: warning: no previous prototype for
>   'zero_pages_sharing_show' [-Wmissing-prototypes].
> ---
>   mm/ksm.c | 19 +++++++++++++++++--
>   1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 652c088f9786..72c0722be280 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -276,6 +276,9 @@ static unsigned int zero_checksum __read_mostly;
>   /* Whether to merge empty (zeroed) pages with actual zero pages */
>   static bool ksm_use_zero_pages __read_mostly;
> 
> +/* The number of zero pages placed by KSM use_zero_pages */
> +static unsigned long ksm_zero_pages_sharing;

Does this count how many zero pages are currently placed or how many 
rmap items with ZERO_PAGE_FLAG are in the system?

IOW, if someone triggers MADV_DONTNEED on such a zeropage, the counter 
will not get updated, correct?


-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ