diff options
| author | Lorenzo Stoakes (ARM) <ljs@kernel.org> | 2026-09-23 18:17:54 +0100 |
|---|---|---|
| committer | Nathan Chancellor <nathan@kernel.org> | 2026-09-26 00:16:34 +0100 |
| commit | c2970d8b52d132bf5152fba592205a2204d7be5a (patch) | |
| tree | 936d8185f223e301b3604a7f82679b0fc3fad7d5 /tools/lib/python | |
| parent | 4719513c0fa2a39a2410448120a83cb1a416b194 (diff) | |
| download | linux-next-c2970d8b52d132bf5152fba592205a2204d7be5a.tar.gz linux-next-c2970d8b52d132bf5152fba592205a2204d7be5a.zip | |
kbuild: do not sort nm output where the order is irrelevant
Unless instructed otherwise, nm sorts by name.
There are places where this is unnecessary - an invocation from
scripts/sorttable every vmlinux link, scripts/check-function-names.sh run
after every vmlinux.o link, and the x86 VOFFSET and ZOFFSET listings
between vmlinux and bzImage.
Both GNU nm and llvm-nm accept the same '-p' parameter to disable sorting
in these instances, so use that to prevent this unnecessary work.
Each nm run on its own, x86-64, median of 5:
GNU nm 2.47 llvm-nm 22
before after delta before after delta
defconfig
sorttable, nm -S vmlinux 0.080s 0.039s -0.041s 0.265s 0.113s -0.152s
check-function-names.sh 0.072s 0.033s -0.039s 0.244s 0.102s -0.142s
VOFFSET 0.077s 0.034s -0.043s 0.261s 0.113s -0.148s
ZOFFSET 0.007s 0.005s -0.002s 0.005s 0.005s 0.000s
TOTAL -0.125s -0.442s
allmodconfig
sorttable, nm -S vmlinux 0.156s 0.063s -0.093s 0.539s 0.223s -0.316s
check-function-names.sh 0.149s 0.054s -0.095s 0.537s 0.217s -0.320s
VOFFSET 0.146s 0.052s -0.094s 0.524s 0.221s -0.303s
ZOFFSET 0.007s 0.005s -0.002s 0.006s 0.004s -0.002s
TOTAL -0.284s -0.941s
llvm-nm appears to be a lot slower than GNU nm, so these builds naturally
improve the most.
The four run one after another in the serial tail of every build that links
vmlinux so impact kernel builds directly.
In an allmodconfig the decompressor is built in parallel while the modules,
so only the two before the vmlinux link contribute to build time.
The build outputs remain unchanged.
Whole build, 128-thread Threadripper 9980X, best of N runs:
before after delta
---------------------------------
x86 defconfig, touch mm/vma.c, gcc 9.7s 9.5s -0.18s (-2%)
x86 defconfig, touch mm/vma.c, clang 9.3s 9.0s -0.27s (-3%)
x86 defconfig, clean, gcc 30.3s 30.1s -0.16s (-1%)
x86 defconfig, clean, clang 31.7s 31.2s -0.55s (-2%)
x86 allmodconfig, touch mm/vma.c, clang 36.4s 35.8s -0.67s (-2%)
Assisted-by: LLM
Reviewed-by: Nicolas Schier <n.schier@fritz.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-5-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
