[PATCH 0/3] Speed up modprobe
Timo Teräs
timo.teras at iki.fi
Sat Jun 18 15:56:45 UTC 2011
Hi,
So instead of rewriting the config_*, I decided to just do the parts that
give the most benefit. And fixing APIs usually should happen incrementally
anyway... that leads to better APIs :)
I did basic testing that things should work still. However, 'make check'
seems to fail for some weird reasons (e.g. sed tests just seg.fault) even
without my patches, so I was not able to run test suite. I also did regular
valgrinding on the patched binary, and there was no complaints.
I benchmarked simple modprobe with callgrind (= userland cycles, not
including kernel read() time). And the speedup is following:
- start situation: 177M
- after modprobe hash: 148M
- after config_* using getline: 65M
- after config_* no per-line malloc: 57M
So the original code is >3x slower than after the patches. Though, the wall
clock execution time might not be as much affected as we do spend time in
kernel read() too.
The module hashing is +51 bytes, and the getline changes (without the
compat function) is around +90 bytes.
Cheers,
Timo
Timo Teräs (3):
modprobe: use hash table for module entry database
platform: provide getline and getdelim if not available
parse_config: use getline to read config
include/libbb.h | 3 +-
include/platform.h | 6 ++++
libbb/parse_config.c | 74 +++++++++++++++++++++++++------------------------
libbb/platform.c | 36 ++++++++++++++++++++++++
modutils/modprobe.c | 13 +++++++--
5 files changed, 92 insertions(+), 40 deletions(-)
More information about the busybox
mailing list