Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.) The vmcore file maybe very big. For example, I have a vmcore file which is over 23G, and the panic kernel had 767.6G memory, its max_sect_len is 4468736. Current code costs too much time to do the following loop: .............................................. for (i = 1; i < max_sect_len + 1; i++) { dd->valid_pages[i] = dd->valid_pages[i - 1]; for (j = 0; j < BITMAP_SECT_LEN; j++, pfn++) if (page_is_dumpable(pfn)) dd->valid_pages[i]++; .............................................. For my case, it costs about 56 seconds to finish the big loop. This patch moves the hweightXX macros to defs.h, and uses hweight64 to optimize the loop. For my vmcore, the loop only costs about one second now. 2.) Tests result: # cat ./commands.txt quit Before: #echo 3 > /proc/sys/vm/drop_caches; #time ./crash -i ./commands.txt /root/t/vmlinux /root/t/vmcore > /dev/null 2>&1 ............................ real 1m54.259s user 1m12.494s sys 0m3.857s ............................ After this patch: #echo 3 > /proc/sys/vm/drop_caches; #time ./crash -i ./commands.txt /root/t/vmlinux /root/t/vmcore > /dev/null 2>&1 ............................ real 0m55.217s user 0m15.114s sys 0m3.560s ............................ Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
- Loading branch information