public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Wu XiangCheng <wu.xiangcheng@linux.dev>
To: Yanteng Si <siyanteng@loongson.cn>
Cc: alexs@kernel.org, seakeel@gmail.com, corbet@lwn.net,
	chenhuacai@kernel.org, linux-doc@vger.kernel.org,
	siyanteng01@gmail.com
Subject: Re: [PATCH v1 11/13] docs/zh_CN: Update the translation of ksm to 6.1-rc8
Date: Fri, 9 Dec 2022 15:09:51 +0800	[thread overview]
Message-ID: <Y5LfP5oGiSCpYYP8@bobwxc.mipc> (raw)
In-Reply-To: <ebb3d10b22f0b11305a819ad03e6a0a531ec6678.1670502763.git.siyanteng@loongson.cn>

> Update to commit 21b7bdb504ae ("ksm: add profit monitoring
> documentation")
> 
> commit 94bfe85bde18 ("mm/vmstat: add events for ksm cow")
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>  .../translations/zh_CN/admin-guide/mm/ksm.rst | 50 +++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst b/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst
> index 4829156ef1ae..e27806aa90dc 100644
> --- a/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst
> +++ b/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst
> @@ -146,3 +146,53 @@ stable_node_dups
>  
>  比值 ``pages_sharing/pages_shared`` 的最大值受限制于 ``max_page_sharing``
>  的设定。要想增加该比值,则相应地要增加 ``max_page_sharing`` 的值。
> +
> +监测KSM的好处

好处 => 收益

> +=============
> +
> +KSM可以通过合并相同的页面来节省内存,但也会消耗额外的内存,因为它需要生成一些rmap_items
> +来保存每个扫描页面的简要rmap信息。其中有些页面可能会被合并,但有些页面在被检查几次
> +后可能无法被合并,这些都是无益的内存消耗。
> +
> +1) 如何确定KSM在全系统范围内是节省内存还是消耗内存?这里有一个简单的近似计算方法供参考::
> +
> +       general_profit =~ pages_sharing * sizeof(page) - (all_rmap_items) *
> +                         sizeof(rmap_item);
> +
> +   其中all_rmap_items可以通过对 ``pages_sharing`` 、 ``pages_shared`` 、 ``pages_unshared``
> +   和 ``pages_volatile`` 的求和而轻松获得。
> +
> +2) KSM的好处在一个单一的进程中也可以通过以下近似的计算得到::

单一进程中KSM的收益

> +
> +       process_profit =~ ksm_merging_pages * sizeof(page) -
> +                         ksm_rmap_items * sizeof(rmap_item).
> +
> +   其中ksm_merging_pages显示在 ``/proc/<pid>/`` 目录下,而ksm_rmap_items
> +   显示在 ``/proc/<pid>/ksm_stat`` 。
> +
> +从应用的角度来看, ``ksm_rmap_items`` 和 ``ksm_merging_pages`` 的高比例意
> +味着不好的madvise-applied策略,所以开发者或管理员必须重新考虑如何改变madvis策
> +略。举个例子供参考,一个页面的大小通常是4K,而rmap_item的大小在32位CPU架构上分
> +别是32B,在64位CPU架构上是64B。所以如果 ``ksm_rmap_items/ksm_merging_pages``
> +的比例在64位CPU上超过64,或者在32位CPU上超过128,那么应用程序的madvise策略应
> +该被放弃,因为ksm好处大约为零或负值。

好处 => 收益

> +
> +监控KSM事件
> +===========
> +
> +在/proc/vmstat中有一些计数器,可以用来监控KSM事件。KSM可能有助于节省内存,这是
> +一种权衡,因为它可能会在KSM COW或复制中的交换上遭受延迟。这些事件可以帮助用户评估
> +是否或如何使用KSM。例如,如果cow_ksm增加得太快,用户可以减少madvise(, , MADV_MERGEABLE)
> +的范围。
> +
> +cow_ksm
> +        在每次KSM页面触发写时拷贝(COW)时都会被递增,当用户试图写到KSM页面时,

写到 => 写入

> +        我们必须做一个拷贝。
> +
> +ksm_swpin_copy
> +        在换入时,每次KSM页被复制时都会被递增。请注意,KSM页在换入时可能会被复
> +        制,因为do_swap_page()不能做所有的锁,而需要重组一个跨anon_vma的KSM页。
> +
> +--
> +Izik Eidus,
> +Hugh Dickins, 2009年11月17日。
> -- 
> 2.31.1
> 

  reply	other threads:[~2022-12-09  7:10 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08 12:57 [PATCH v1 00/13] docs/zh_CN: Update the translation to 6.1-rc8 Yanteng Si
2022-12-08 12:57 ` [PATCH v1 01/13] docs/zh_CN: Update the translation of delay-accounting " Yanteng Si
2022-12-09  6:55   ` Wu XiangCheng
2022-12-10  2:51     ` Yanteng Si
2022-12-08 12:57 ` [PATCH v1 02/13] docs/zh_CN: Update the translation of kernel-api " Yanteng Si
2022-12-09  6:57   ` Wu XiangCheng
2022-12-08 12:57 ` [PATCH v1 03/13] docs/zh_CN: Update the translation of mm-api " Yanteng Si
2022-12-09  7:01   ` Wu XiangCheng
2022-12-08 12:57 ` [PATCH v1 04/13] docs/zh_CN: Update the translation of highmem " Yanteng Si
2022-12-09  7:02   ` Wu XiangCheng
2022-12-08 12:57 ` [PATCH v1 05/13] docs/zh_CN: Update the translation of page_owner " Yanteng Si
2022-12-09  7:03   ` Wu XiangCheng
2022-12-08 12:57 ` [PATCH v1 06/13] docs/zh_CN: Update the translation of kasan " Yanteng Si
2022-12-09  7:33   ` Wu XiangCheng
2022-12-10  3:11     ` Yanteng Si
2022-12-08 12:58 ` [PATCH v1 07/13] docs/zh_CN: Update the translation of testing-overview " Yanteng Si
2022-12-09  7:05   ` Wu XiangCheng
2022-12-10  2:56     ` Yanteng Si
2022-12-08 12:59 ` [PATCH v1 08/13] docs/zh_CN: Update the translation of reclaim " Yanteng Si
2022-12-09  7:06   ` Wu XiangCheng
2022-12-08 12:59 ` [PATCH v1 09/13] docs/zh_CN: Update the translation of start " Yanteng Si
2022-12-09  7:07   ` Wu XiangCheng
2022-12-08 12:59 ` [PATCH v1 10/13] docs/zh_CN: Update the translation of usage " Yanteng Si
2022-12-09  7:08   ` Wu XiangCheng
2022-12-08 12:59 ` [PATCH v1 11/13] docs/zh_CN: Update the translation of ksm " Yanteng Si
2022-12-09  7:09   ` Wu XiangCheng [this message]
2022-12-10  3:04     ` Yanteng Si
2022-12-08 12:59 ` [PATCH v1 12/13] docs/zh_CN: Update the translation of msi-howto " Yanteng Si
2022-12-09  7:10   ` Wu XiangCheng
2022-12-08 12:59 ` [PATCH v1 13/13] docs/zh_CN: Update the translation of energy-model " Yanteng Si
2022-12-09  7:12   ` Wu XiangCheng
2022-12-10  3:06     ` Yanteng Si

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=Y5LfP5oGiSCpYYP8@bobwxc.mipc \
    --to=wu.xiangcheng@linux.dev \
    --cc=alexs@kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=seakeel@gmail.com \
    --cc=siyanteng01@gmail.com \
    --cc=siyanteng@loongson.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