[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: udev performance



On Wed, Sep 12, 2007 at 09:04:09AM +0200, Harald Hoyer wrote:
> Using a modprobe wrapper, I count 56 /sbin/modprobe calls taking ~4s 
> (non-profiling udev) on my laptop, from which 23 are not found.
> 23 * /sbin/modprobe with a modalias, which is not found, sums up to ~1s 
> (25%) of the time.
> So we can easily eliminate 25% of the modprobe time (on my laptop), by 
> collecting all /sys/***/modalias at depmod time, which cannot be resolved, 
> and store them in /lib/modules/$(uname -r)/modules.unresolved, which could 
> be searched first by modprobe.

BTW, each read_depends below will scan the whole modules.dep (if unsuccessful)
or first part thereof.  In the modprobes that take most of the time, is
modules.dep read just once or multiple times?

                /* Returns the resolved alias, options */
                read_toplevel_config(config, modulearg, 0,
                     remove, &modoptions, &commands, &aliases, &blacklist);

                /* No luck?  Try symbol names, if starts with symbol:. */
                if (!aliases
                    && strncmp(modulearg, "symbol:", strlen("symbol:")) == 0)
                        read_config(symfilename, modulearg, 0,
                            remove, &modoptions, &commands,
                                &aliases, &blacklist);

                if (!aliases) {
                        /* We only use canned aliases as last resort. */
                        read_depends(dirname, modulearg, &list);

                        if (list_empty(&list)
                            && !find_command(modulearg, commands))
                        {
                                read_config(aliasfilename, modulearg, 0,
                                            remove, &modoptions, &commands,
                                            &aliases, &blacklist);
                                aliases = apply_blacklist(aliases, blacklist);
                        }
                }

                if (aliases) {
                        errfn_t err = error;

                        /* More than one alias?  Don't bail out on failure. */
                        if (aliases->next)
                                err = warn;
                        while (aliases) {
                                /* Add the options for this alias. */
                                char *opts = NOFAIL(strdup(optstring));
                                opts = add_extra_options(modulearg,
                                                         opts, modoptions);

                                read_depends(dirname, aliases->module, &list);
                                handle_module(aliases->module, &list, newname,
                                              remove, opts, first_time, err,
                                              dry_run, verbose, modoptions,
                                              commands, ignore_commands,
                                              ignore_proc, strip_vermagic,
                                              strip_modversion,
                                              unknown_silent,
                                              optstring);

                                aliases = aliases->next;
                                INIT_LIST_HEAD(&list);
                        }
                } else {
                        if (use_blacklist
                            && find_blacklist(modulearg, blacklist))
                                continue;

                        handle_module(modulearg, &list, newname, remove,
                                      optstring, first_time, error, dry_run,
                                      verbose, modoptions, commands,
                                      ignore_commands, ignore_proc,
                                      strip_vermagic, strip_modversion,
                                      unknown_silent, optstring);
                }



	Jakub


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]