Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
mm: make some vars and functions static or __init
Browse files Browse the repository at this point in the history
"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/[email protected]
Signed-off-by: Ting Liu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Ting Liu authored and torvalds committed Jan 15, 2022
1 parent 0b8f0d8 commit cab0a7c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion include/linux/page_idle.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* 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 folio_test_young(struct folio *folio)
{
Expand Down
4 changes: 2 additions & 2 deletions mm/page_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,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
Expand Down
4 changes: 2 additions & 2 deletions mm/page_owner.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,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;
}
Expand Down Expand Up @@ -75,7 +75,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;
Expand Down

0 comments on commit cab0a7c

Please sign in to comment.