i recognized that a "simple" 'ifup lan' can be
very expensive for a router with low ressources,
below a typcal call/execution trace:

hotplug-call: $1 = 'iface' START: 1139
hotplug-call: $1 = 'net' START: 1141
hotplug-call: script: /etc/hotplug.d/iface/00-netstate START: 1139
hotplug-call: script: /etc/hotplug.d/net/00-sysctl START: 1141
hotplug-call: script: /etc/hotplug.d/iface/00-netstate READY: 1139
hotplug-call: script: /etc/hotplug.d/net/00-sysctl READY: 1141
hotplug-call: script: /etc/hotplug.d/iface/15-teql START: 1139
hotplug-call: script: /etc/hotplug.d/net/99-batman-adv START: 1141
hotplug-call: script: /etc/hotplug.d/iface/30-6relay START: 1139
hotplug-call: script: /etc/hotplug.d/net/99-batman-adv READY: 1141
hotplug-call: $1 = 'net' READY: 1141
hotplug-call: $1 = 'net' START: 1168
hotplug-call: script: /etc/hotplug.d/net/00-sysctl START: 1168
hotplug-call: script: /etc/hotplug.d/net/00-sysctl READY: 1168
hotplug-call: script: /etc/hotplug.d/net/99-batman-adv START: 1168
hotplug-call: script: /etc/hotplug.d/net/99-batman-adv READY: 1168
hotplug-call: $1 = 'net' READY: 1168
hotplug-call: script: /etc/hotplug.d/iface/30-6relay READY: 1139
hotplug-call: script: /etc/hotplug.d/iface/50-olsrd START: 1139
hotplug-call: script: /etc/hotplug.d/iface/50-olsrd READY: 1139
hotplug-call: $1 = 'iface' READY: 1139
hotplug-call: $1 = 'iface' START: 1194
hotplug-call: script: /etc/hotplug.d/iface/00-netstate START: 1194
hotplug-call: script: /etc/hotplug.d/iface/00-netstate READY: 1194
hotplug-call: script: /etc/hotplug.d/iface/15-teql START: 1194
hotplug-call: script: /etc/hotplug.d/iface/15-teql READY: 1194
hotplug-call: script: /etc/hotplug.d/iface/30-6relay START: 1194
hotplug-call: script: /etc/hotplug.d/iface/30-6relay READY: 1194
hotplug-call: script: /etc/hotplug.d/iface/50-olsrd START: 1194
hotplug-call: script: /etc/hotplug.d/iface/50-olsrd READY: 1194
hotplug-call: $1 = 'iface' READY: 1194

we can see, that there a some calls to the shell-script '/sbin/hotplug-call'
with argument 'iface' or 'net' and the script itself sources again all
scripts found in the 'iface' or 'net'-folder. the calls for 'iface'
and 'net' run in parallel. (last number is process-id).

is it really needed to run in parallel? maybe it can be made configurable
to run one after another?

i would like to send some optimizations, e.g. for the script
'/etc/hotplug.d/iface/00-netstate' we can change the external call

sed -ne 's![^0-9].*$!!p' /proc/uptime

to

cut -d'.' -f1 /proc/uptime

or even to use only internal calls:

read UP REST </proc/up  - and then use ${UP%.*}

are the 'micro-optimizations' and nobody cares or is this ok?

fun fact: at the moment it can last several minutes on lowmem-routers
to do these easy tasks, because of the heavy forking/memory usage involved.

bye, bastian
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to