diff options
author | Tejun Heo <tj@kernel.org> | 2013-01-18 14:05:56 -0800 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-01-18 14:05:56 -0800 |
commit | bb813f4c933ae9f887a014483690d5f8b8ec05e1 (patch) | |
tree | 04107b0ae2d1881960dea63b623915db159ecacc /init/main.c | |
parent | 84b233adcca3cacd5cfa8013a5feda7a3db4a9af (diff) | |
download | linux-bb813f4c933ae9f887a014483690d5f8b8ec05e1.tar.gz linux-bb813f4c933ae9f887a014483690d5f8b8ec05e1.tar.bz2 linux-bb813f4c933ae9f887a014483690d5f8b8ec05e1.zip |
init, block: try to load default elevator module early during boot
This patch adds default module loading and uses it to load the default
block elevator. During boot, it's called right after initramfs or
initrd is made available and right before control is passed to
userland. This ensures that as long as the modules are available in
the usual places in initramfs, initrd or the root filesystem, the
default modules are loaded as soon as possible.
This will replace the on-demand elevator module loading from elevator
init path.
v2: Fixed build breakage when !CONFIG_BLOCK. Reported by kbuild test
robot.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alex Riesen <raa.lkml@gmail.com>
Cc: Fengguang We <fengguang.wu@intel.com>
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/init/main.c b/init/main.c index baf1f0f5c461..18efadb11cf6 100644 --- a/init/main.c +++ b/init/main.c @@ -70,6 +70,8 @@ #include <linux/perf_event.h> #include <linux/file.h> #include <linux/ptrace.h> +#include <linux/blkdev.h> +#include <linux/elevator.h> #include <asm/io.h> #include <asm/bugs.h> @@ -794,6 +796,17 @@ static void __init do_pre_smp_initcalls(void) do_one_initcall(*fn); } +/* + * This function requests modules which should be loaded by default and is + * called twice right after initrd is mounted and right before init is + * exec'd. If such modules are on either initrd or rootfs, they will be + * loaded before control is passed to userland. + */ +void __init load_default_modules(void) +{ + load_default_elevator_module(); +} + static int run_init_process(const char *init_filename) { argv_init[0] = init_filename; @@ -898,4 +911,7 @@ static void __init kernel_init_freeable(void) * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ + + /* rootfs is available now, try loading default modules */ + load_default_modules(); } |