On Monday 19 September 2011 15:38, Laurent Bercot wrote:
> >> mdev could also be patched to be run as a "mdevd" daemon listening
> >> to the netlink. That would solve the speed problem related to
> >> /etc/mdev.conf parsing, and would still be orders of magnitude below
> >> the complexity of udevd.
>
> After closer examination of the mdev.c source code, I must say I was
> wrong. As it is now, the /etc/mdev.conf file is parsed on every event.
> (And it makes sense: since this file describes what to do on an event,
> its natural to read it on an event.)
> The only way to speed this up is to pre-parse the /etc/mdev.conf file:
> compile it once into a fast access structure which can then be
> interpreted on every event. This fast access structure could be stored
> in memory, if we're to have a long-running "mdevd" program ; or it
> could be stored as another, less user-friendly, file (for instance a
> cdb file) if we're still going to have one mdev invocation per event.
>
> I'm not sure this is worth it - mdev -s is only run once at boot time,
> and once /etc/mdev.conf is in the filesystem cache, the parsing should
> be CPU-bound, which means it can be run in parallel with other
> initialization tasks (that are majorly IO-bound) without a performance
> loss.
Still, on mdev -s, this:
xregcomp(&match, val, REG_EXTENDED);
is done for every line of /etc/mdev.conf, for *every device*.
Might be quite slow on low-power devices...
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox