aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2009-12-23 16:43:07 +0000
committerJohn Rigby <john.rigby@linaro.org>2012-06-25 15:03:49 -0600
commita044f284a707cef5d2202eb15e6ccff46d702f08 (patch)
tree0154abf550f88a98aea6b19cd521a21ec48da7e9
parentbb2ba8a08d98e6e43037d2f7905753b9682a99b0 (diff)
UBUNTU: SAUCE: async_populate_rootfs: move rootfs init earlier
Check to see if the machine has more than one active CPU, if it does then it is worth starting the decode of the rootfs earlier. Signed-off-by: Andy Whitcroft <apw@canonical.com>
-rw-r--r--include/asm-generic/vmlinux.lds.h1
-rw-r--r--include/linux/init.h1
-rw-r--r--init/initramfs.c15
3 files changed, 16 insertions, 1 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 8aeadf6b553..0a446925327 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -626,6 +626,7 @@
*(.initcallearly.init) \
INIT_CALLS_LEVEL(0) \
INIT_CALLS_LEVEL(1) \
+ INIT_CALLS_LEVEL(earlyrootfs) \
INIT_CALLS_LEVEL(2) \
INIT_CALLS_LEVEL(3) \
INIT_CALLS_LEVEL(4) \
diff --git a/include/linux/init.h b/include/linux/init.h
index 280d329b882..ad021e87d5a 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -196,6 +196,7 @@ extern bool initcall_debug;
#define core_initcall(fn) __define_initcall("1",fn,1)
#define core_initcall_sync(fn) __define_initcall("1s",fn,1s)
+#define earlyrootfs_initcall(fn) __define_initcall("earlyrootfs",fn,rootfs)
#define postcore_initcall(fn) __define_initcall("2",fn,2)
#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s)
#define arch_initcall(fn) __define_initcall("3",fn,3)
diff --git a/init/initramfs.c b/init/initramfs.c
index 39dbed3ad9c..91312f76e1c 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -612,9 +612,22 @@ static void __init async_populate_rootfs(void)
return;
}
+static int __initdata rootfs_populated;
+
+static int __init populate_rootfs_early(void)
+{
+ if (num_online_cpus() > 1) {
+ rootfs_populated = 1;
+ async_schedule_domain(async_populate_rootfs, NULL,
+ &populate_rootfs_domain);
+ }
+}
static int __init populate_rootfs(void)
{
- async_schedule_domain(async_populate_rootfs, NULL, &populate_rootfs_domain);
+ if (!rootfs_populated)
+ async_schedule_domain(async_populate_rootfs, NULL,
+ &populate_rootfs_domain);
}
+earlyrootfs_initcall(populate_rootfs_early);
rootfs_initcall(populate_rootfs);