select() timeouts on large installations
David Zeuthen
david at fubar.dk
Wed Aug 24 09:12:50 PDT 2005
Cornelia Huck wrote:
> 2005/8/23, David Zeuthen <david at fubar.dk>:
>
>
>>I'd turn on verbose logging and redirect stderr to a file to see what is
>>taking so long. Assuming we're CPU bound, profiling may help too, e.g.
>>what functions are we spending time in..
>
>
> hal_device_store_match_key_value_string() as called from
> hotplug_event_begin_sysfs() seems to be one of the main culprits. It'll
> take longer and longer towards the end of device detection (no wonder,
> since more and more devices have been added). Since it is also called
> for devices that won't show up in the end, it is called more than double
> than the amount of devices we end up with on s390 boxen (since we don't
> add subchannels).
Interesting.. I'd expect that to be the main offender. Maybe we want the
device store to have some kind of Index implemented via a hash-table so
we can do O(1) look-ups.
For example, say we want to index devices on all properties with the
name linux.sysfs_path... we need to make it generic enough such that we
don't leak any names e.g. linux into the generic parts of the code.
>>Btw, noone tried optimizing this before... there should be some
>>low-hanging fruit... For instance looking up a property is O(n) and it
>>could *easily* be made O(1) using e.g. GHashTable...
>
>
> Sounds like a good idea and should really help in this case. Maybe
> a hash table for all known devices would also help to speed up finding
> devices?
Heh, yea, as I rambled about above.
> I'll see if I can hack something together...
Very cool, thanks a lot.
Cheers,
David
More information about the hal
mailing list