Re: [PATCH] mm/page_ext: init page_ext early if there are no deferred struct pages

From: Andrew Morton
Date: Tue Jan 17 2023 - 20:18:03 EST


On Tue, 17 Jan 2023 20:46:17 +0000 Pasha Tatashin <pasha.tatashin@xxxxxxxxxx> wrote:

> page_ext must be initialized after all struct pages are initialized.
> Therefore, page_ext is initialized after page_alloc_init_late(), and
> can optionally be initialized earlier via early_page_ext kernel
> parameter which as a side effect also disables deferred struct pages.
>
> Allow to automatically init page_ext early when there are no deferred
> struct pages in order to be able to use page_ext during kernel boot
> and track for example page allocations early.

Compilation blows up with CONFIG_PAGE_EXTENSION=n. I did

--- a/include/linux/page_ext.h~mm-page_ext-init-page_ext-early-if-there-are-no-deferred-struct-pages-fix
+++ a/include/linux/page_ext.h
@@ -92,6 +92,7 @@ static inline struct page_ext *page_ext_

#else /* !CONFIG_PAGE_EXTENSION */
struct page_ext;
+#define deferred_struct_pages (0)

static inline bool early_page_ext_enabled(void)
{

but it then blew up differently.