Commit 4634ef55 authored by Nanyong Sun's avatar Nanyong Sun
Browse files

mm/ksm: generalize ksm_process_profit

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8YMGX


CVE: NA

--------------------------------

The ksm_process_profit() was only used by procfs before, so it is built
under CONFIG_PROC_FS. Now memcg with ksm also call it, so delete the
CONFIG_PROC_FS compilation dependency to make it more general.

Fixes: 8bafb5ea ("memcg: support ksm merge any mode per cgroup")
Signed-off-by: default avatarNanyong Sun <sunnanyong@huawei.com>
parent e076c150
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -87,9 +87,7 @@ void collect_procs_ksm(struct page *page, struct list_head *to_kill,
		       int force_early);
#endif

#ifdef CONFIG_PROC_FS
long ksm_process_profit(struct mm_struct *);
#endif /* CONFIG_PROC_FS */

#else  /* !CONFIG_KSM */

+0 −2
Original line number Diff line number Diff line
@@ -3106,13 +3106,11 @@ static void wait_while_offlining(void)
}
#endif /* CONFIG_MEMORY_HOTREMOVE */

#ifdef CONFIG_PROC_FS
long ksm_process_profit(struct mm_struct *mm)
{
	return (long)(mm->ksm_merging_pages + mm->ksm_zero_pages) * PAGE_SIZE -
		mm->ksm_rmap_items * sizeof(struct ksm_rmap_item);
}
#endif /* CONFIG_PROC_FS */

#ifdef CONFIG_SYSFS
/*