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:
@@ -1310,6 +1310,11 @@ if BLK_DEV_INITRD
|
|||||||
|
|
||||||
source "usr/Kconfig"
|
source "usr/Kconfig"
|
||||||
|
|
||||||
|
config INITRD_ASYNC
|
||||||
|
bool "Initrd async"
|
||||||
|
help
|
||||||
|
Init ramdisk async, can reduce kernel init time.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config BOOT_CONFIG
|
config BOOT_CONFIG
|
||||||
|
|||||||
@@ -639,4 +639,23 @@ done:
|
|||||||
flush_delayed_fput();
|
flush_delayed_fput();
|
||||||
return 0;
|
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);
|
rootfs_initcall(populate_rootfs);
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1550,6 +1550,10 @@ static noinline void __init kernel_init_freeable(void)
|
|||||||
|
|
||||||
kunit_run_all_tests();
|
kunit_run_all_tests();
|
||||||
|
|
||||||
|
#if IS_BUILTIN(CONFIG_INITRD_ASYNC)
|
||||||
|
async_synchronize_full();
|
||||||
|
#endif
|
||||||
|
|
||||||
console_on_rootfs();
|
console_on_rootfs();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user