@@ -587,6 +587,7 @@
*(.initcall0s.init) \
*(.initcall1.init) \
*(.initcall1s.init) \
+ *(.initcallearlyrootfs.init) \
*(.initcall2.init) \
*(.initcall2s.init) \
*(.initcall3.init) \
@@ -186,6 +186,7 @@ extern void (*late_time_init)(void);
#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)
@@ -609,9 +609,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);