From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org, yang.shi@linaro.org, vbabka@suse.cz,
rostedt@goodmis.org, Pavel.Tatashin@microsoft.com,
mhocko@kernel.org, mhiramat@kernel.org,
mgorman@techsingularity.net, mark-pk.tsai@mediatek.com,
lizefan.x@bytedance.com, keescook@chromium.org, Jason@zx2c4.com,
iamjoonsoo.kim@lge.com, cai@lca.pw, lizhe.67@bytedance.com,
akpm@linux-foundation.org
Subject: + page_ext-move-up-page_ext_init-to-catch-early-page-allocation-if-deferred_struct_page_init-is-n.patch added to mm-unstable branch
Date: Wed, 17 Aug 2022 10:54:47 -0700 [thread overview]
Message-ID: <20220817175448.CB033C433C1@smtp.kernel.org> (raw)
The patch titled
Subject: page_ext: move up page_ext_init() to catch early page allocation if DEFERRED_STRUCT_PAGE_INIT is n
has been added to the -mm mm-unstable branch. Its filename is
page_ext-move-up-page_ext_init-to-catch-early-page-allocation-if-deferred_struct_page_init-is-n.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/page_ext-move-up-page_ext_init-to-catch-early-page-allocation-if-deferred_struct_page_init-is-n.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Li Zhe <lizhe.67@bytedance.com>
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 different kernel booting.
Link: https://lkml.kernel.org/r/20220815120954.65957-1-lizhe.67@bytedance.com
Signed-off-by: Li Zhe <lizhe.67@bytedance.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Kees Cook <keescook@chromium.org>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Cc: Zefan Li <lizefan.x@bytedance.com>
Cc: Qian Cai <cai@lca.pw>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Pasha Tatashin <Pavel.Tatashin@microsoft.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Yang Shi <yang.shi@linaro.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
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
@@ -72,7 +92,11 @@ static inline void pgdat_page_ext_init(s
{
}
-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
@@ -458,7 +458,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@bytedance.com are
page_ext-move-up-page_ext_init-to-catch-early-page-allocation-if-deferred_struct_page_init-is-n.patch
reply other threads:[~2022-08-17 17:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220817175448.CB033C433C1@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=Jason@zx2c4.com \
--cc=Pavel.Tatashin@microsoft.com \
--cc=cai@lca.pw \
--cc=iamjoonsoo.kim@lge.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=lizhe.67@bytedance.com \
--cc=mark-pk.tsai@mediatek.com \
--cc=mgorman@techsingularity.net \
--cc=mhiramat@kernel.org \
--cc=mhocko@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=vbabka@suse.cz \
--cc=yang.shi@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.