Re: [PATCH 13/23] modpost: hash module source per-file, not per-byte

From: Petr Pavlu

Date: Thu Sep 10 2026 - 09:01:20 EST


On 9/8/26 10:55 PM, Lorenzo Stoakes (ARM) wrote:
> modpost spends a long time md4 hashing module source at a per-byte
> granularity.
>
> Fix this by doing this hashing per-file instead by accumulating a per-file
> buffer in parse_file().
>
> All 11,189 .mod.c files and Module.symvers were confirmed to be identical
> with this change applied.
>
> This is especially impactful for allmodconfig incremental builds (where
> CONFIG_MODULE_SRCVERSION_ALL is set).
>
> Whole build, 128-thread Threadripper 9980X, best of N runs:
>
> before after delta
> -------------------------------
> x86 allmodconfig, touch mm/vma.c, gcc 40.6s 38.2s -2.4s (-6%)
> x86 allmodconfig, touch mm/vma.c, clang 36.2s 35.0s -1.2s (-3%)
>
> Assisted-by: LLM
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> ---
> scripts/mod/sumversion.c | 56 +++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 44 insertions(+), 12 deletions(-)

Support for the module srcversion is being removed in "module: remove
MODULE_VERSION() and srcversion" [1] and scripts/mod/sumversion.c should
be gone completely.

[1] https://lore.kernel.org/linux-modules/20260731-module_ver_remove-v2-0-c9163858f382@xxxxxxxxxxxxxxxxxxx/

--
Thanks,
Petr