[RESEND RFC PATCH v1 14/20] mm: expose ksm merge type in ksm_stat

From: Stefan Roesch
Date: Mon Jan 23 2023 - 13:06:32 EST


This exposes the ksm process type in /proc/<pid>/ksm_stat. The name of
the value is ksm_merge_type.

Signed-off-by: Stefan Roesch <shr@xxxxxxxxxxxx>
---
fs/proc/base.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index a2b7779f76f6..2b63a70fb7a6 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3200,6 +3200,7 @@ static int proc_pid_ksm_merging_pages(struct seq_file *m, struct pid_namespace *

return 0;
}
+
static int proc_pid_ksm_stat(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
@@ -3209,6 +3210,7 @@ static int proc_pid_ksm_stat(struct seq_file *m, struct pid_namespace *ns,
if (mm) {
seq_printf(m, "ksm_rmap_items %lu\n", mm->ksm_rmap_items);
seq_printf(m, "ksm_merging_pages %lu\n", mm->ksm_merging_pages);
+ seq_printf(m, "ksm_merge_type %s\n", ksm_merge_type(mm));
seq_printf(m, "ksm_process_profit %ld\n", ksm_process_profit(mm));
mmput(mm);
}
--
2.30.2