Hi!
Given the recent 5sec boot efforts
http://lwn.net/Articles/299483/
and Mandriva follow-ups on that
http://lwn.net/Articles/300873/,
I thought I'd share my modprobe and MAKEDEV speedup patches with
a wider community so folks can experiment with them, especially seeing
Mandriva folks playing with turning modprobe into a daemon because of its
slowness.
modprobe is quite slow, as it on every invocation sources a ~ 7500
line long modules.alias file from which it calls fnmatch on the wildcards
from every line, and a ~ 350KB modules.dep file which it searches through
for module dependencies, but usually those files are just generated by
depmod -a and never modified by humans afterwards. This patch in depmod -a
in addition to generation of the text files writes more compact binary files
which are only used if the text file hasn't been modified and allow much
faster searching for aliases or dependencies.
MAKEDEV sources almost 500KB of config files on every invocation, and the
inner loop is terribly inefficient. The second patch allows it to shrink
the files to 55KB while expressing the same info and makes the inner loop
more efficient. Depending on how many modprobe and MAKEDEV invocations
are done on your box during bootup, this can or might not make meassurable
difference.
The modprobe patch has been actually posted almost a year ago privately,
but nothing has been changed upstream, below is an updated version, retested
against latest rawhide module-init-tools, the MAKEDEV patch is actually from
last week. IMHO the binary caches for modprobe are better than
having thousands of symlinks around (given 7500 wildcards where for many of
them a few dozens of symlinks would be needed), especially if the symlinks
would be included in rpm package, but I can be of course convinced
otherwise. In any case, the module-init-tools contains a bunch of speedups
that are IMHO desirable anyway, even without the modules.{dep,alias}cache
files.
Jakub