aboutsummaryrefslogtreecommitdiff
path: root/init/initramfs.c
diff options
context:
space:
mode:
authorSurbhi Palande <surbhi.palande@canonical.com>2009-12-08 11:44:34 +0200
committerLeann Ogasawara <leann.ogasawara@canonical.com>2010-08-11 07:39:08 -0700
commitdf77cc60cd520af67a6ffa02c373ae9e661258e2 (patch)
treeac52582ffa4d8245d7bb2ce82a08a74be35ef679 /init/initramfs.c
parentbbed2608309eb705c44867e0d2655e20db8914e8 (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>
Diffstat (limited to 'init/initramfs.c')
-rw-r--r--init/initramfs.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/init/initramfs.c b/init/initramfs.c
index 4b9c2020509..1a1be7a105e 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -8,6 +8,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)
@@ -568,7 +569,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_end - __initramfs_start);
@@ -582,7 +585,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,
@@ -606,6 +609,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);