All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit fe53ca54 authored by Yang Shi's avatar Yang Shi Committed by Linus Torvalds

mm: use early_pfn_to_nid in page_ext_init

page_ext_init() checks suitable pages with pfn_to_nid(), but
pfn_to_nid() depends on memmap which will not be setup fully until
page_alloc_init_late() is done.  Use early_pfn_to_nid() instead of
pfn_to_nid() so that page extension could be still used early even
though CONFIG_ DEFERRED_STRUCT_PAGE_INIT is enabled and catch early page
allocation call sites.

Suggested by Joonsoo Kim [1], this fix basically undoes the change
introduced by commit b8f1a75d ("mm: call page_ext_init() after all
struct pages are initialized") and fixes the same problem with a better


Link: default avatarYang Shi <>
Cc: Joonsoo Kim <>
Cc: Mel Gorman <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent f871f191
......@@ -607,6 +607,7 @@ asmlinkage __visible void __init start_kernel(void)
initrd_start = 0;
......@@ -1003,8 +1004,6 @@ static noinline void __init kernel_init_freeable(void)
/* Initialize page ext after all struct pages are initializaed */
......@@ -390,8 +390,10 @@ void __init page_ext_init(void)
* We know some arch can have a nodes layout such as
* -------------pfn-------------->
* N0 | N1 | N2 | N0 | N1 | N2|....
* Take into account DEFERRED_STRUCT_PAGE_INIT.
if (pfn_to_nid(pfn) != nid)
if (early_pfn_to_nid(pfn) != nid)
if (init_section_page_ext(pfn, nid))
goto oom;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment