Hi Daisuke,
On Wed, Mar 23, 2022 at 08:09:49AM +0000, d.hatayama(a)fujitsu.com wrote:
verify_namelist() uses strings command and scans full part of
vmlinux
file to find linux_banner string. However, vmlinux file is quite large
these days, reaching over 500MB. As a result, this degradates start-up
time of crash command 10 or more seconds. (Of course, this depends on
machines you use for investigation, but I guess typically we cannot
use such powerful machines to investigate crash dump...)
To resolve this issue, let's use bfd library and read linux_banner
string in vmlinux file directly.
A simple benchmark shows the following result:
Without the fix:
# cat ./commands.txt
quit
# time ./crash -i ./commands.txt \
/usr/lib/debug/lib/modules/5.16.15-201.fc35.x86_64/vmlinux \
/var/crash/*/vmcore >/dev/null 2>&1
real 0m20.251s
user 0m19.022s
sys 0m1.054s
With the fix:
# time ./crash -i ./commands.txt \
/usr/lib/debug/lib/modules/5.16.15-201.fc35.x86_64/vmlinux \
/var/crash/*/vmcore >/dev/null 2>&1
real 0m6.528s
user 0m6.143s
sys 0m0.431s
Note that this commit keeps the original logic that uses strings
command for backward compatibility for in case.
I tested this patch with my vmcore (over 10G).
Before this patch:
time ./crash -i ./commands.txt /root/t/vmlinux-5.4.119-1-gamematrix-015e /root/t/vmcore
> /dev/null 2>&1
real 1m19.052s
user 1m17.333s
sys 0m1.675s
After:
#time ./crash -i ./commands.txt /root/t/vmlinux-5.4.119-1-gamematrix-015e /root/t/vmcore
> /dev/null 2>&1
real 1m16.609s
user 1m14.655s
sys 0m1.903s
It seems this patch does not improve too much.
Thanks
Huang Shijie