aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2021-11-05 13:40:40 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-11-06 13:30:38 -0700
commitd2635f2012a44e3d469ab9a4022162dbe0e53f21 (patch)
tree82a5a4ab8294a039d8fad83f9c0c729c8a4bf361 /init
parentmm/page_alloc.c: show watermark_boost of zone in zoneinfo (diff)
downloadlinux-dev-d2635f2012a44e3d469ab9a4022162dbe0e53f21.tar.xz
linux-dev-d2635f2012a44e3d469ab9a4022162dbe0e53f21.zip
mm: create a new system state and fix core_kernel_text()
core_kernel_text() considers that until system_state in at least SYSTEM_RUNNING, init memory is valid. But init memory is freed a few lines before setting SYSTEM_RUNNING, so we have a small period of time when core_kernel_text() is wrong. Create an intermediate system state called SYSTEM_FREEING_INIT that is set before starting freeing init memory, and use it in core_kernel_text() to report init memory invalid earlier. Link: https://lkml.kernel.org/r/9ecfdee7dd4d741d172cb93ff1d87f1c58127c9a.1633001016.git.christophe.leroy@csgroup.eu Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@ozlabs.org> Cc: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
-rw-r--r--init/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/init/main.c b/init/main.c
index 3c4054a95545..767ee2672176 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1506,6 +1506,8 @@ static int __ref kernel_init(void *unused)
kernel_init_freeable();
/* need to finish all async __init code before freeing the memory */
async_synchronize_full();
+
+ system_state = SYSTEM_FREEING_INITMEM;
kprobe_free_init_mem();
ftrace_free_init_mem();
kgdb_free_init_mem();