Re: [PATCH 13/23] modpost: hash module source per-file, not per-byte
From: Petr Pavlu
Date: Fri Sep 11 2026 - 08:02:40 EST
On 9/11/26 12:41 PM, Lorenzo Stoakes (ARM) wrote:
> On Thu, Sep 10, 2026 at 02:52:50PM +0200, Petr Pavlu wrote:
>> 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.
>
> Hmm, that series doesn't remove the script though, is that planned as a follow up?
My reply to that series [1] notes that it should also remove
scripts/mod/sumversion.c. It should be done in the next version.
>
> I guess I can drop this patch from the series then :) Also patch 17 I think?
I agree. The module srcversion is no longer needed since build IDs are
nowadays the standard mechanism for providing effectively the same
functionality. While I'm not sure when the mentioned removal will land,
reviewing and polishing this patch and patch 17 would IMO be wasteful at
this point.
[1] https://lore.kernel.org/linux-modules/4e321525-708c-4964-9937-d94ea27e8d85@xxxxxxxx/
--
Thanks,
Petr