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

xu.xin16@zte.com.cn posted 6 patches 1 week, 3 days ago
[PATCH linux-next v3 4/6] ksm: make ksm_process_profit available on CONFIG_PROCFS=n
Posted by xu.xin16@zte.com.cn 1 week, 3 days ago
From: xu xin <xu.xin16@zte.com.cn>

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@intel.com>
Closes: https://lore.kernel.org/all/202509142046.QatEaTQV-lkp@intel.com/
Signed-off-by: xu xin <xu.xin16@zte.com.cn>
---
 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
Re: [PATCH linux-next v3 4/6] ksm: make ksm_process_profit available on CONFIG_PROCFS=n
Posted by David Hildenbrand 1 week, 1 day ago
On 21.09.25 17:13, xu.xin16@zte.com.cn wrote:
> From: xu xin <xu.xin16@zte.com.cn>
> 
> This remove the restriction CONFIG_PROCFS=y for the heler function

s/heler/helper.

> ksm_process_profit(), then we can use it for the later patches on
> CONFIG_PROCFS=n.


Better to something like this:

"Let's provide ksm_process_profit() also without CONFIG_PROCFS so we can 
use it from memcg code next."

?

> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/all/202509142046.QatEaTQV-lkp@intel.com/

Both tags should be dropped as there is nothing fixed here.

> Signed-off-by: xu xin <xu.xin16@zte.com.cn>
> ---
>   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 {


-- 
Cheers

David / dhildenb