[PATCH] Speed up modprobe and MAKEDEV

Jakub Jelinek jakub at redhat.com
Wed Oct 1 18:27:10 UTC 2008


On Wed, Oct 01, 2008 at 01:20:38PM -0400, Kyle McMartin wrote:
> On Wed, Oct 01, 2008 at 06:52:15PM +0200, Jakub Jelinek wrote:
> > 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.
> > 
> 
> Definitely. The biggest win by far for MAKEDEV is profiling the often
> hit devices, and prioritizing things. Dave Airlie moved a bunch of the
> cciss and other almost never-seen devices to be sourced last and ended
> up with a huge win.

If the ordering makes significant difference, then there is further work on
it.  My patch was mainly about speeding up the read_configs part, although
the more compact config files mean several times less entries as well.

makedevices then does a linear search through the entries.  What we could do
is put the entries into a hash table, hashed by the name_prefix_len bytes
long prefix, or skip the entries that don't match any command line
arguments.  I guess for many command line arguments the hash table could be
a win, for very few the skipping.  Even just separate chains for each
starting letter could cut the number of entries down a lot (only 3 letters
with more than 100 entries), though they aren't evenly distributed; just
computing a hash and using 256 buckets with chains would be probably enough
though.

> Have you tested things on a big endian machine?

I have not, can easily do that tomorrow on ppc64.  That said, the file
format has an endian 4byte word in the header to verify depmod and modprobe
agree on endianity, if they don't, the *cache files just aren't used and the
slower (still somewhat faster wrt. vanilla modprobe) reading of the text
config files is used, similarly to the case where used hand modifies them.

> really good. Hopefully Jon will apply this upstream soon so we can get
> it in F10.

That's where I don't have such high hopes, as I've mailed the patch to Jon
already more than 10 months ago.

	Jakub




More information about the fedora-devel-list mailing list