linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/ksm: delete the redundant ksm_merging_pages interafce in proc
@ 2023-06-27 13:35 Nanyong Sun
  2023-06-27 19:22 ` Andrew Morton
       [not found] ` <20230628031233.9734-1-xu.xin16@zte.com.cn>
  0 siblings, 2 replies; 4+ messages in thread
From: Nanyong Sun @ 2023-06-27 13:35 UTC (permalink / raw)
  To: akpm; +Cc: xu.xin16, wangkefeng.wang, linux-kernel, linux-mm, sunnanyong

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-28  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 13:35 [PATCH] mm/ksm: delete the redundant ksm_merging_pages interafce in proc Nanyong Sun
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox