Skip to content
Commit 2bc92c61 authored by Jack Brennen's avatar Jack Brennen Committed by Greg Kroah-Hartman
Browse files

modpost: Optimize symbol search from linear to binary search



[ Upstream commit 40745327 ]

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: default avatarJack Brennen <jbrennen@google.com>
Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: 1102f9f8 ("modpost: do not make find_tosym() return NULL")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 55ed6c47
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment