[PATCH linux-next v3 4/6] ksm: make ksm_process_profit available on CONFIG_PROCFS=n

From: xu.xin16

Date: Sun Sep 21 2025 - 11:13:47 EST


From: xu xin <xu.xin16@xxxxxxxxxx>

This remove the restriction CONFIG_PROCFS=y for the heler function
ksm_process_profit(), then we can use it for the later patches on
CONFIG_PROCFS=n.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/all/202509142046.QatEaTQV-lkp@xxxxxxxxx/
Signed-off-by: xu xin <xu.xin16@xxxxxxxxxx>
---
mm/ksm.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index e49f4b86ffb0..a68d4b37b503 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -3282,7 +3282,6 @@ static void wait_while_offlining(void)
}
#endif /* CONFIG_MEMORY_HOTREMOVE */

-#ifdef CONFIG_PROC_FS
/*
* The process is mergeable only if any VMA is currently
* applicable to KSM.
@@ -3307,7 +3306,6 @@ long ksm_process_profit(struct mm_struct *mm)
return (long)(mm->ksm_merging_pages + mm_ksm_zero_pages(mm)) * PAGE_SIZE -
mm->ksm_rmap_items * sizeof(struct ksm_rmap_item);
}
-#endif /* CONFIG_PROC_FS */

#ifdef CONFIG_MEMCG
struct memcg_ksm_stat {
--
2.25.1