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 4bd3d726a3
commit 8d228fbbce
3 changed files with 17 additions and 1 deletions

View file

@ -44,8 +44,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)
{
}
@ -69,6 +73,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

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

View file

@ -102,6 +102,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 unsigned long get_entry_size(void)
{
return sizeof(struct page_ext) + extra_mem;
@ -185,7 +192,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: