I'd like to use deferred init calls. This function allows to load modules in userland, that should actually be loaded during the boot sequence.

Just for testing I'd like to modularize as many entries as possible of the startup. For applying this method the module_init() in those modules has to be renamed to deferred_module_init(), easy so far.

Now my question is: where can I find all these files with module_init()? Because I already wrote a bash script, that replaces this string with the defered_module_init in the whole kernel source - unfortunately it covers some other functions too, which made it impossible to compile the kernel afterwards.

Is there a directory or a list with the modules that should be used during startup?

I found that passing initcall_debug to the kernel command line generates a list with the modules, that then can be viewed with this command, that tells me the name of the module

dmesg -s 128000 | grep "initcall" | sed "s/\(.*\)after\(.*\)/\2 \1/g" | sort -n

But it looks like these names are spread all over the kernel source :/. Is there an easy way to catch all of these entries, so that i can apply my bash script to replace that specific string?

Doing this by foot seems like a job that can take forever.

Here's a sample output:

286 usecs [    0.910000] initcall arc4_init+0x0/0x1c returned 0   
287 usecs [    0.910000] initcall aes_init+0x0/0x1c returned 0   
288 usecs [    0.900000] initcall crypto_wq_init+0x0/0x4c returned 0
  • Some of the modules loaded during boot can't be loaded later (devices, root filessytem). So doing this across the board is probably a bad idea. Isn't it enough to get the modules loaded by the initramfs, and do the rest of the module loading on demand later? The page for deferred init calls cites kernel version 2.6.7, the oldest longterm kernel at kernel.org is 2.6.32, quite a lot newer. – vonbrand Mar 10 '14 at 17:47
  • Yes indeed that makes sense, but still for the most modules the loading process can be shifted in the back. No it ain't enough to get them loaded by initramfs ;) since I'd like to speed up my system as much as possible – user3085931 Mar 12 '14 at 10:40
  • loading them on boot before they are needed slows it down – vonbrand Mar 12 '14 at 11:13
  • that's why I'd like to use the deferred_initcalls, to keep them out of the boot process – user3085931 Mar 12 '14 at 12:03
  • If they are needed to boot, they will be accessed and installed for boot to work; don't letting that happen as directly as possible wil slow the boot down. If they aren't, they won't; so they don't afect boot speed. Unless they are loaded "by hand," that is. If it is boot speed you are after, look into systemd (it includes tools to measure the whole boot process, I'd bet "module loading" isn't even a blip there), into faster disk (my current ultrabook has a smallish "cache" SSD, it speeds up boot enormously). – vonbrand Mar 12 '14 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.