
From: Ting Liu <liuting.0x7c00@bytedance.com> mainline inclusion from mainline-v5.17-rc1 commit cab0a7c115546a4865fb7439558af9077a569574 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I9GSSR Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... -------------------------------- "page_idle_ops" as a global var, but its scope of use within this document. So it should be static. "page_ext_ops" is a var used in the kernel initial phase. And other functions are aslo used in the kernel initial phase. So they should be __init or __initdata to reclaim memory. Link: https://lkml.kernel.org/r/20211217095023.67293-1-liuting.0x7c00@bytedance.co... Signed-off-by: Ting Liu <liuting.0x7c00@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Conflicts: include/linux/page_idle.h [context conflicts] Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com> --- include/linux/page_idle.h | 1 - mm/page_ext.c | 4 ++-- mm/page_owner.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/linux/page_idle.h b/include/linux/page_idle.h index d8a6aecf99cb..8ac4926d396f 100644 --- a/include/linux/page_idle.h +++ b/include/linux/page_idle.h @@ -43,7 +43,6 @@ static inline void clear_page_idle(struct page *page) * If there is not enough space to store Idle and Young bits in page flags, use * page ext flags instead. */ -extern struct page_ext_operations page_idle_ops; static inline bool page_is_young(struct page *page) { diff --git a/mm/page_ext.c b/mm/page_ext.c index 8e59da0f4367..e807366017ff 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c @@ -63,12 +63,12 @@ static bool need_page_idle(void) { return true; } -struct page_ext_operations page_idle_ops = { +static struct page_ext_operations page_idle_ops __initdata = { .need = need_page_idle, }; #endif -static struct page_ext_operations *page_ext_ops[] = { +static struct page_ext_operations *page_ext_ops[] __initdata = { #ifdef CONFIG_PAGE_OWNER &page_owner_ops, #endif diff --git a/mm/page_owner.c b/mm/page_owner.c index 15f2b8f1e0c5..bd1b0e9e11de 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -55,7 +55,7 @@ static int __init early_page_owner_param(char *buf) } early_param("page_owner", early_page_owner_param); -static bool need_page_owner(void) +static __init bool need_page_owner(void) { return page_owner_enabled; } @@ -84,7 +84,7 @@ static noinline void register_early_stack(void) early_handle = create_dummy_stack(); } -static void init_page_owner(void) +static __init void init_page_owner(void) { if (!page_owner_enabled) return; -- 2.25.1