]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Call populate_rootfs later in boot
authorAndrew Morton <akpm@osdl.org>
Wed, 21 Apr 2004 00:42:18 +0000 (17:42 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 21 Apr 2004 00:42:18 +0000 (17:42 -0700)
populate_rootfs() is called rather early - before we've called init_idle().

But populate_rootfs() does file I/O, which involves calls to cond_resched(),
and downing of semaphores, etc.  If it scheules, the scheduler emits
scheduling-while-atomic warnings and sometimes oopses.

So run populate_rootfs() later, after the scheduler is all set up.

init/main.c

index c500c6fe296df2c878a819de580a3af1a0ed12eb..84cf96dddf4e6c82d780e99b06a73e7ae6831acd 100644 (file)
@@ -89,6 +89,7 @@ extern void radix_tree_init(void);
 extern void free_initmem(void);
 extern void populate_rootfs(void);
 extern void driver_init(void);
+extern void prepare_namespace(void);
 
 #ifdef CONFIG_TC
 extern void tc_init(void);
@@ -471,7 +472,6 @@ asmlinkage void __init start_kernel(void)
        signals_init();
        /* rootfs populating might need page-writeback */
        page_writeback_init();
-       populate_rootfs();
 #ifdef CONFIG_PROC_FS
        proc_root_init();
 #endif
@@ -577,8 +577,6 @@ static void run_init_process(char *init_filename)
        execve(init_filename, argv_init, envp_init);
 }
 
-extern void prepare_namespace(void);
-
 static int init(void * unused)
 {
        lock_kernel();
@@ -600,14 +598,15 @@ static int init(void * unused)
        smp_init();
        do_basic_setup();
 
-       /*
-        * check if there is an early userspace init, if yes
-        * let it do all the work
-        */
-       if (sys_access("/init", 0) == 0)
-               execute_command = "/init";
-       else
-       prepare_namespace();
+       populate_rootfs();
+       /*
+        * check if there is an early userspace init.  If yes, let it do all
+        * the work
+        */
+       if (sys_access("/init", 0) == 0)
+               execute_command = "/init";
+       else
+               prepare_namespace();
 
        /*
         * Ok, we have completed the initial bootup, and