On Tue, Sep 11, 2007 at 05:40:27PM +0200, Harald Hoyer wrote:
A while back I did some experiments with systemtap and found that modprobe was doing a linear search through modules.deps:
http://sourceware.org/ml/systemtap/2007-q1/msg00140.html
I wrote a script that would prepend the modules that are actually used to the beginning of modules.dep to reduce the average length of search. This reduced the amount of data read (and time spent waiting for I/O) and slightly reduced the time to boot the machine. Bootchart samples process state periodically. Below is some of the data extracted from the bootchart samples:
all states D state modprobe modprobe samples samples
normal modules.dep 120 73 reordered modules.deps 63 27
Having to linearly through 250K of text in modules.dep each time a module is loaded doesn't seem very efficient.
-Will
Problem is, that most of the modprobes with a modalias are not existent and so every line is parsed.
If modules.dep searching really takes significant time, then there is always an option to precompile it into a more efficient format, e.g. more compact, with a hash table or whatever best matches modprobe's use.
Jakub