From: David Hildenbrand <david@redhat.com>
To: yang.yang29@zte.com.cn, akpm@linux-foundation.org
Cc: imbrenda@linux.ibm.com, jiang.xuexin@zte.com.cn,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
ran.xiaokai@zte.com.cn, xu.xin.sc@gmail.com, xu.xin16@zte.com.cn
Subject: Re: [PATCH v5 4/6] ksm: count zero pages for each process
Date: Wed, 18 Jan 2023 15:31:16 +0100 [thread overview]
Message-ID: <688bd1cb-0b4c-3b4f-6af9-7a07da3d16fa@redhat.com> (raw)
In-Reply-To: <202212300916292181912@zte.com.cn>
On 30.12.22 02:16, yang.yang29@zte.com.cn wrote:
> From: xu xin <xu.xin16@zte.com.cn>
>
> As the number of ksm zero pages is not included in ksm_merging_pages per
> process when enabling use_zero_pages, it's unclear of how many actual
> pages are merged by KSM. To let users accurately estimate their memory
> demands when unsharing KSM zero-pages, it's necessary to show KSM zero-
> pages per process.
>
> since unsharing zero pages placed by KSM accurately is achieved, then
> tracking empty pages merging and unmerging is not a difficult thing any
> longer.
>
> Since we already have /proc/<pid>/ksm_stat, just add the information of
> zero_pages_sharing in it.
>
> Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Xuexin Jiang <jiang.xuexin@zte.com.cn>
> Cc: Xiaokai Ran <ran.xiaokai@zte.com.cn>
> Cc: Yang Yang <yang.yang29@zte.com.cn>
> Signed-off-by: xu xin <xu.xin16@zte.com.cn>
> ---
> fs/proc/base.c | 1 +
> include/linux/mm_types.h | 7 ++++++-
> mm/ksm.c | 2 ++
> 3 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index 9e479d7d202b..ac9ebe972be0 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -3207,6 +3207,7 @@ static int proc_pid_ksm_stat(struct seq_file *m, struct pid_namespace *ns,
> mm = get_task_mm(task);
> if (mm) {
> seq_printf(m, "ksm_rmap_items %lu\n", mm->ksm_rmap_items);
> + seq_printf(m, "zero_pages_sharing %lu\n", mm->ksm_zero_pages_sharing);
> mmput(mm);
> }
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 4e1031626403..5c734ebc1890 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -776,7 +776,7 @@ struct mm_struct {
> #ifdef CONFIG_KSM
> /*
> * Represent how many pages of this process are involved in KSM
> - * merging.
> + * merging (not including ksm_zero_pages_sharing).
> */
> unsigned long ksm_merging_pages;
> /*
> @@ -784,6 +784,11 @@ struct mm_struct {
> * including merged and not merged.
> */
> unsigned long ksm_rmap_items;
> + /*
> + * Represent how many empty pages are merged with kernel zero
> + * pages when enabling KSM use_zero_pages.
> + */
> + unsigned long ksm_zero_pages_sharing;
Same comment as for previous patch: this counts rmap itmaps, no?
ksm_zero_rmap_items might be more appropriate.
--
Thanks,
David / dhildenb
prev parent reply other threads:[~2023-01-18 14:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-30 1:16 yang.yang29
2023-01-18 14:31 ` David Hildenbrand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=688bd1cb-0b4c-3b4f-6af9-7a07da3d16fa@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=imbrenda@linux.ibm.com \
--cc=jiang.xuexin@zte.com.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ran.xiaokai@zte.com.cn \
--cc=xu.xin.sc@gmail.com \
--cc=xu.xin16@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox