[PATCH 17/23] modpost: perform srcversion hashing in parallel
Yann Droneaud
yann at droneaud.fr
Sat Sep 12 04:50:00 PDT 2026
Hi,
Le 08/09/2026 à 22:55, Lorenzo Stoakes (ARM) a écrit :
> modpost does a lot of single-threaded work hashing files from each object's
> .cmd file.
>
> This makes the build slower than it needs to be, so do this work in
> parallel.
If you're going parallel, it would be nicer to do it under make's
jobserver supervision.
> This is egregious for allmodconfig builds - for instance x86-64 can end up
> opening 200,000 files individually and hashing them all serially.
>
> Parallelise this operation by maintaining a thread pool for the hashing
> work.
>
> Combined with the per-file hashing commit this cuts modpost's run time
> nearly in half for an allmodconfig build.
>
> Module.symvers and every *.mod.S are byte for byte the same.
>
> modpost is on the serial tail of every allmodconfig build, however
> defconfig does not set CONFIG_MODULE_SRCVERSION_ALL and is unchanged.
>
> Whole build, 128-thread Threadripper 9980X, best of N runs:
>
> before after delta
> -------------------------------
> x86 allmodconfig, touch mm/vma.c, gcc 33.4s 30.2s -3.2s (-10%)
> x86 allmodconfig, touch mm/vma.c, clang 31.1s 28.1s -3.0s (-10%)
>
> Assisted-by: LLM
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs at kernel.org>
> ---
> scripts/mod/Makefile | 1 +
> scripts/mod/modpost.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++--
> scripts/mod/modpost.h | 2 ++
> scripts/mod/sumversion.c | 3 +-
> 4 files changed, 74 insertions(+), 4 deletions(-)
>
Regards.
More information about the linux-riscv
mailing list