The quilt patch titled Subject: page_ext: move up page_ext_init() to catch early page allocation if DEFERRED_STRUCT_PAGE_INIT is n has been removed from the -mm tree. Its filename was page_ext-move-up-page_ext_init-to-catch-early-page-allocation-if-deferred_struct_page_init-is-n.patch This patch was dropped because it was nacked ------------------------------------------------------ From: Li Zhe <lizhe.67@xxxxxxxxxxxxx> Subject: page_ext: move up page_ext_init() to catch early page allocation if DEFERRED_STRUCT_PAGE_INIT is n Date: Mon, 15 Aug 2022 20:09:54 +0800 In commit 2f1ee0913ce5 ("Revert "mm: use early_pfn_to_nid in page_ext_init"") we call page_ext_init() after page_alloc_init_late() to avoid some panic problem. It seems that we cannot track early page allocations in current kernel even if page structure has been initialized early. This patch moves up page_ext_init() to catch early page allocations when DEFERRED_STRUCT_PAGE_INIT is n. After this patch, we only need to turn DEFERRED_STRUCT_PAGE_INIT to n then we are able to analyze the early page allocations. This is useful especially when we find that the free memory value is not the same right after booting a different kernel. Link: https://lkml.kernel.org/r/20220815120954.65957-1-lizhe.67@xxxxxxxxxxxxx Signed-off-by: Li Zhe <lizhe.67@xxxxxxxxxxxxx> Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Jason A. Donenfeld <Jason@xxxxxxxxx> Cc: Mark-PK Tsai <mark-pk.tsai@xxxxxxxxxxxx> Cc: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> Cc: Zefan Li <lizefan.x@xxxxxxxxxxxxx> Cc: Qian Cai <cai@xxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Pasha Tatashin <Pavel.Tatashin@xxxxxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Yang Shi <yang.shi@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/page_ext.h | 30 +++++++++++++++++++++++++++--- init/main.c | 7 +++++-- mm/page_ext.c | 2 +- 3 files changed, 33 insertions(+), 6 deletions(-) --- a/include/linux/page_ext.h~page_ext-move-up-page_ext_init-to-catch-early-page-allocation-if-deferred_struct_page_init-is-n +++ a/include/linux/page_ext.h @@ -43,14 +43,34 @@ extern void pgdat_page_ext_init(struct p static inline void page_ext_init_flatmem(void) { } -extern void page_ext_init(void); static inline void page_ext_init_flatmem_late(void) { } +extern void _page_ext_init(void); +#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT +static inline void page_ext_init_early(void) +{ +} +static inline void page_ext_init_late(void) +{ + _page_ext_init(); +} +#else +static inline void page_ext_init_early(void) +{ + _page_ext_init(); +} +static inline void page_ext_init_late(void) +{ +} +#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ #else extern void page_ext_init_flatmem(void); extern void page_ext_init_flatmem_late(void); -static inline void page_ext_init(void) +static inline void page_ext_init_early(void) +{ +} +static inline void page_ext_init_late(void) { } #endif @@ -76,7 +96,11 @@ static inline struct page_ext *lookup_pa return NULL; } -static inline void page_ext_init(void) +static inline void page_ext_init_early(void) +{ +} + +static inline void page_ext_init_late(void) { } --- a/init/main.c~page_ext-move-up-page_ext_init-to-catch-early-page-allocation-if-deferred_struct_page_init-is-n +++ a/init/main.c @@ -845,6 +845,7 @@ static void __init mm_init(void) * slab is ready so that stack_depot_init() works properly */ page_ext_init_flatmem_late(); + page_ext_init_early(); kmemleak_init(); pgtable_init(); debug_objects_mem_init(); @@ -1605,8 +1606,10 @@ static noinline void __init kernel_init_ padata_init(); page_alloc_init_late(); - /* Initialize page ext after all struct pages are initialized. */ - page_ext_init(); + /* Initialize page ext after all struct pages are initialized if + * CONFIG_DEFERRED_STRUCT_PAGE_INIT is enabled + */ + page_ext_init_late(); do_basic_setup(); --- a/mm/page_ext.c~page_ext-move-up-page_ext_init-to-catch-early-page-allocation-if-deferred_struct_page_init-is-n +++ a/mm/page_ext.c @@ -378,7 +378,7 @@ static int __meminit page_ext_callback(s return notifier_from_errno(ret); } -void __init page_ext_init(void) +void __init _page_ext_init(void) { unsigned long pfn; int nid; _ Patches currently in -mm which might be from lizhe.67@xxxxxxxxxxxxx are