From: Zhang Zekun zhangzekun11@huawei.com
Offering: HULK hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I53VVE
------------------------------------------
Add a config to control the feature in bugzilla which export the function collect_procs().
Signed-off-by: Zhang Zekun zhangzekun11@huawei.com --- arch/arm64/configs/openeuler_defconfig | 1 + arch/x86/configs/openeuler_defconfig | 1 + include/linux/mm.h | 3 +++ mm/Kconfig | 7 +++++++ mm/memory-failure.c | 7 +++++++ 5 files changed, 19 insertions(+)
diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 78a63cbc3db6..8dd8e7d0c5f3 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -1110,6 +1110,7 @@ CONFIG_ARCH_HAS_PTE_SPECIAL=y CONFIG_PIN_MEMORY=y CONFIG_PID_RESERVE=y CONFIG_MEMORY_RELIABLE=y +CONFIG_EXPORT_COLLECT_PROCS=y
# # Data Access Monitoring diff --git a/arch/x86/configs/openeuler_defconfig b/arch/x86/configs/openeuler_defconfig index f9c94b618ad4..9da862afc6b8 100644 --- a/arch/x86/configs/openeuler_defconfig +++ b/arch/x86/configs/openeuler_defconfig @@ -1059,6 +1059,7 @@ CONFIG_ARCH_HAS_PKEYS=y # CONFIG_READ_ONLY_THP_FOR_FS is not set CONFIG_ARCH_HAS_PTE_SPECIAL=y CONFIG_MAPPING_DIRTY_HELPERS=y +CONFIG_EXPORT_COLLECT_PROCS=y
# # Data Access Monitoring diff --git a/include/linux/mm.h b/include/linux/mm.h index a886f48b6a0e..03dbae9a3007 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3109,8 +3109,11 @@ extern int sysctl_memory_failure_recovery; extern void shake_page(struct page *p, int access); extern atomic_long_t num_poisoned_pages __read_mostly; extern int soft_offline_page(unsigned long pfn, int flags); + +#ifdef CONFIG_EXPORT_COLLECT_PROCS extern void collect_procs(struct page *page, struct list_head *tokill, int force_early); +#endif
/* * Error handlers for various types of pages. diff --git a/mm/Kconfig b/mm/Kconfig index 4475bd9f8762..a36deacdf480 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -969,6 +969,13 @@ config MEMORY_RELIABLE To enable this function, mirrored memory is needed and "kernelcore=reliable" need to be added in kernel parameters.
+config EXPORT_COLLECT_PROCS + bool "Export the function collect_procs()" + default n + help + Export this function to collect the processes who have the page + mapped via collect_procs(). + source "mm/damon/Kconfig"
endmenu diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 509fe34a0421..d2784bf013bb 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -541,8 +541,13 @@ static void collect_procs_file(struct page *page, struct list_head *to_kill, /* * Collect the processes who have the corrupted page mapped to kill. */ +#ifdef CONFIG_EXPORT_COLLECT_PROCS void collect_procs(struct page *page, struct list_head *tokill, int force_early) +#else +static void collect_procs(struct page *page, struct list_head *tokill, + int force_early) +#endif { if (!page->mapping) return; @@ -552,7 +557,9 @@ void collect_procs(struct page *page, struct list_head *tokill, else collect_procs_file(page, tokill, force_early); } +#ifdef CONFIG_EXPORT_COLLECT_PROCS EXPORT_SYMBOL_GPL(collect_procs); +#endif
static const char *action_name[] = { [MF_IGNORED] = "Ignored",