]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
modpost: Optimize symbol search from linear to binary search
authorJack Brennen <jbrennen@google.com>
Tue, 26 Sep 2023 12:40:44 +0000 (08:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:35:47 +0000 (16:35 +0200)
commit2bc92c61c5417982e7b92ba628281f411d31013c
treef2fc7e236ad99e71d4afc0a1858e8496eb75ca1d
parent55ed6c477872bac7be7e688a6c3af57654ee0049
modpost: Optimize symbol search from linear to binary search

[ Upstream commit 4074532758c5c367d3fcb8d124150824a254659d ]

Modify modpost to use binary search for converting addresses back
into symbol references.  Previously it used linear search.

This change saves a few seconds of wall time for defconfig builds,
but can save several minutes on allyesconfigs.

Before:
$ make LLVM=1 -j128 allyesconfig vmlinux -s KCFLAGS="-Wno-error"
$ time scripts/mod/modpost -M -m -a -N -o vmlinux.symvers vmlinux.o
198.38user 1.27system 3:19.71elapsed

After:
$ make LLVM=1 -j128 allyesconfig vmlinux -s KCFLAGS="-Wno-error"
$ time scripts/mod/modpost -M -m -a -N -o vmlinux.symvers vmlinux.o
11.91user 0.85system 0:12.78elapsed

Signed-off-by: Jack Brennen <jbrennen@google.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: 1102f9f85bf6 ("modpost: do not make find_tosym() return NULL")
Signed-off-by: Sasha Levin <sashal@kernel.org>
scripts/mod/Makefile
scripts/mod/modpost.c
scripts/mod/modpost.h
scripts/mod/symsearch.c [new file with mode: 0644]