mm: fix the page_owner initializing issue for arm32

arm32 original logic:
1. allocated memory for page_ext(using memblock).
2. invoke the init callback of page_ext_ops like
page_owner(using buddy).
3. initialize buddy.

after this change:
1. allocated memory for page_ext(using memblock).
2. initialize buddy.
3. invoke the init callback of page_ext_ops like
page_owner(using buddy).

with the change, failure/dummy_handle can get its correct value.

Change-Id: I6598481299da115ff4be50bf0e5a61a012d5ac83
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
This commit is contained in:
Zhenhua Huang 2020-08-31 00:20:35 +08:00
parent 1a6f8ce5e2
commit 7f35a1228f
3 changed files with 17 additions and 1 deletions

View File

@ -47,8 +47,12 @@ static inline void page_ext_init_flatmem(void)
{
}
extern void page_ext_init(void);
static inline void page_ext_init_flatmem_late(void)
{
}
#else
extern void page_ext_init_flatmem(void);
extern void page_ext_init_flatmem_late(void);
static inline void page_ext_init(void)
{
}
@ -79,6 +83,10 @@ static inline void page_ext_init(void)
{
}
static inline void page_ext_init_flatmem_late(void)
{
}
static inline void page_ext_init_flatmem(void)
{
}

View File

@ -558,6 +558,8 @@ static void __init mm_init(void)
init_debug_pagealloc();
report_meminit();
mem_init();
/* page_owner must be initialized after buddy is ready */
page_ext_init_flatmem_late();
kmem_cache_init();
kmemleak_init();
pgtable_init();

View File

@ -99,6 +99,13 @@ static void __init invoke_init_callbacks(void)
}
}
#if !defined(CONFIG_SPARSEMEM)
void __init page_ext_init_flatmem_late(void)
{
invoke_init_callbacks();
}
#endif
static inline struct page_ext *get_entry(void *base, unsigned long index)
{
return base + page_ext_size * index;
@ -177,7 +184,6 @@ void __init page_ext_init_flatmem(void)
goto fail;
}
pr_info("allocated %ld bytes of page_ext\n", total_usage);
invoke_init_callbacks();
return;
fail: