From: Nanyong Sun <sunnanyong@huawei.com>
To: <akpm@linux-foundation.org>
Cc: <xu.xin16@zte.com.cn>, <wangkefeng.wang@huawei.com>,
<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<sunnanyong@huawei.com>
Subject: [PATCH] mm/ksm: delete the redundant ksm_merging_pages interafce in proc
Date: Tue, 27 Jun 2023 21:35:42 +0800 [thread overview]
Message-ID: <20230627133542.2446285-1-sunnanyong@huawei.com> (raw)
Since the ksm_merging_pages information already included in
/proc/<pid>/ksm_stat, we can delete /proc/<pid>/ksm_merging_pages to
make the directory more clean, and can save a little bit resources.
Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
---
Documentation/admin-guide/mm/ksm.rst | 6 +++---
.../translations/zh_CN/admin-guide/mm/ksm.rst | 4 ++--
fs/proc/base.c | 15 ---------------
3 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst
index 7626392fe82c..e668d4b5e800 100644
--- a/Documentation/admin-guide/mm/ksm.rst
+++ b/Documentation/admin-guide/mm/ksm.rst
@@ -208,9 +208,9 @@ several times, which are unprofitable memory consumed.
process_profit =~ ksm_merging_pages * sizeof(page) -
ksm_rmap_items * sizeof(rmap_item).
- where ksm_merging_pages is shown under the directory ``/proc/<pid>/``,
- and ksm_rmap_items is shown in ``/proc/<pid>/ksm_stat``. The process profit
- is also shown in ``/proc/<pid>/ksm_stat`` as ksm_process_profit.
+ where ksm_merging_pages and ksm_rmap_items is shown in the file
+ ``/proc/<pid>/ksm_stat``. The process profit is also shown in
+ ``/proc/<pid>/ksm_stat`` as ksm_process_profit.
From the perspective of application, a high ratio of ``ksm_rmap_items`` to
``ksm_merging_pages`` means a bad madvise-applied policy, so developers or
diff --git a/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst b/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst
index 0029c4fd2201..1662f271efc8 100644
--- a/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst
+++ b/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst
@@ -167,8 +167,8 @@ 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_merging_pages、ksm_rmap_items显示在 ``/proc/<pid>/ksm_stat`` 文件中,收益
+ 值ksm_process_profit也显示在该文件中。
从应用的角度来看, ``ksm_rmap_items`` 和 ``ksm_merging_pages`` 的高比例意
味着不好的madvise-applied策略,所以开发者或管理员必须重新考虑如何改变madvis策
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 05452c3b9872..173261dbeaea 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3186,19 +3186,6 @@ static int proc_pid_patch_state(struct seq_file *m, struct pid_namespace *ns,
#endif /* CONFIG_LIVEPATCH */
#ifdef CONFIG_KSM
-static int proc_pid_ksm_merging_pages(struct seq_file *m, struct pid_namespace *ns,
- struct pid *pid, struct task_struct *task)
-{
- struct mm_struct *mm;
-
- mm = get_task_mm(task);
- if (mm) {
- seq_printf(m, "%lu\n", mm->ksm_merging_pages);
- mmput(mm);
- }
-
- return 0;
-}
static int proc_pid_ksm_stat(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
@@ -3348,7 +3335,6 @@ static const struct pid_entry tgid_base_stuff[] = {
ONE("seccomp_cache", S_IRUSR, proc_pid_seccomp_cache),
#endif
#ifdef CONFIG_KSM
- ONE("ksm_merging_pages", S_IRUSR, proc_pid_ksm_merging_pages),
ONE("ksm_stat", S_IRUSR, proc_pid_ksm_stat),
#endif
};
@@ -3686,7 +3672,6 @@ static const struct pid_entry tid_base_stuff[] = {
ONE("seccomp_cache", S_IRUSR, proc_pid_seccomp_cache),
#endif
#ifdef CONFIG_KSM
- ONE("ksm_merging_pages", S_IRUSR, proc_pid_ksm_merging_pages),
ONE("ksm_stat", S_IRUSR, proc_pid_ksm_stat),
#endif
};
--
2.25.1
next reply other threads:[~2023-06-27 12:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 13:35 Nanyong Sun [this message]
2023-06-27 19:22 ` Andrew Morton
2023-06-28 2:44 ` Nanyong Sun
[not found] ` <20230628031233.9734-1-xu.xin16@zte.com.cn>
2023-06-28 9:07 ` David Hildenbrand
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=20230627133542.2446285-1-sunnanyong@huawei.com \
--to=sunnanyong@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=wangkefeng.wang@huawei.com \
--cc=xu.xin16@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