diff options
author | Surbhi Palande <surbhi.palande@canonical.com> | 2009-12-08 11:44:34 +0200 |
---|---|---|
committer | John Rigby <john.rigby@linaro.org> | 2012-06-25 15:02:07 -0600 |
commit | f560aad1f0f57fdb0da87cc5023ca9ae3e3dc656 (patch) | |
tree | 7ebb6b51a0478aa8221c3ac11c6452a71617efa5 | |
parent | 5700f7a09765fffabc796d1d6a187604fe6f9415 (diff) |
UBUNTU: SAUCE: Make populate_rootfs asynchronous
The expansion of the initramfs is completely independant of other
boot activities. The original data is already present at boot and the
filesystem is not required until we are ready to start init. It is
therefore reasonable to populate the rootfs asynchronously. Move this
processing to an async call.
This reduces kernel initialisation time (the time from bootloader to
starting userspace) by several 10ths of a second on a selection of test
hardware particularly SMP systems, although UP system also benefit.
Signed-off-by: Surbhi Palande <surbhi.palande@canonical.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
-rw-r--r-- | include/linux/init.h | 2 | ||||
-rw-r--r-- | init/initramfs.c | 15 | ||||
-rw-r--r-- | init/main.c | 6 |
3 files changed, 20 insertions, 3 deletions
diff --git a/include/linux/init.h b/include/linux/init.h index 6b951095a42..280d329b882 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -223,6 +223,8 @@ extern bool initcall_debug; static initcall_t __initcall_##fn \ __used __section(.security_initcall.init) = fn +extern struct list_head populate_rootfs_domain; + struct obs_kernel_param { const char *str; int (*setup_func)(char *); diff --git a/init/initramfs.c b/init/initramfs.c index 84c6bf11130..928a3f2b81d 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -18,6 +18,7 @@ #include <linux/dirent.h> #include <linux/syscalls.h> #include <linux/utime.h> +#include <linux/async.h> static __initdata char *message; static void __init error(char *x) @@ -579,7 +580,9 @@ static void __init clean_rootfs(void) } #endif -static int __init populate_rootfs(void) +LIST_HEAD(populate_rootfs_domain); + +static void __init async_populate_rootfs(void) { char *err = unpack_to_rootfs(__initramfs_start, __initramfs_size); if (err) @@ -592,7 +595,7 @@ static int __init populate_rootfs(void) initrd_end - initrd_start); if (!err) { free_initrd(); - return 0; + return; } else { clean_rootfs(); unpack_to_rootfs(__initramfs_start, __initramfs_size); @@ -616,6 +619,12 @@ static int __init populate_rootfs(void) free_initrd(); #endif } - return 0; + return; } + +static int __init populate_rootfs(void) +{ + async_schedule_domain(async_populate_rootfs, NULL, &populate_rootfs_domain); +} + rootfs_initcall(populate_rootfs); diff --git a/init/main.c b/init/main.c index 0af72b99d00..b0751f0bfe0 100644 --- a/init/main.c +++ b/init/main.c @@ -871,6 +871,12 @@ static int __init kernel_init(void * unused) (void) sys_dup(0); (void) sys_dup(0); /* + * We need to ensure that the filesystem is ready by this point, wait for + * async_populate_rootfs to complete. + */ + async_synchronize_full_domain(&populate_rootfs_domain); + + /* * check if there is an early userspace init. If yes, let it do all * the work */ |