mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
init: support init ramfs async
If enable ramfs function, init ramfs async, can reduce kernel init time. Change-Id: I95d8ca6d8b9c4e9c738c635c5ee56391cbbe7c16 Signed-off-by: Liao Huaping <huaping.liao@rock-chips.com> Signed-off-by: Tao Huang <huangtao@rock-chips.com>
This commit is contained in:
@@ -1142,6 +1142,11 @@ if BLK_DEV_INITRD
|
||||
|
||||
source "usr/Kconfig"
|
||||
|
||||
config INITRD_ASYNC
|
||||
bool "Initrd async"
|
||||
help
|
||||
Init ramdisk async, can reduce kernel init time.
|
||||
|
||||
endif
|
||||
|
||||
choice
|
||||
|
||||
@@ -673,4 +673,23 @@ static int __init populate_rootfs(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if IS_BUILTIN(CONFIG_INITRD_ASYNC)
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/async.h>
|
||||
|
||||
static void __init unpack_rootfs_async(void *unused, async_cookie_t cookie)
|
||||
{
|
||||
populate_rootfs();
|
||||
}
|
||||
|
||||
static int __init populate_rootfs_async(void)
|
||||
{
|
||||
async_schedule(unpack_rootfs_async, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pure_initcall(populate_rootfs_async);
|
||||
#else
|
||||
rootfs_initcall(populate_rootfs);
|
||||
#endif
|
||||
|
||||
@@ -1160,6 +1160,10 @@ static noinline void __init kernel_init_freeable(void)
|
||||
|
||||
do_basic_setup();
|
||||
|
||||
#if IS_BUILTIN(CONFIG_INITRD_ASYNC)
|
||||
async_synchronize_full();
|
||||
#endif
|
||||
|
||||
/* Open the /dev/console on the rootfs, this should never fail */
|
||||
if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
|
||||
pr_err("Warning: unable to open an initial console.\n");
|
||||
|
||||
Reference in New Issue
Block a user