Re: [PATCH v5 03/11] modpost: cache section relocation mismatch state

From: Petr Pavlu

Date: Mon Nov 09 2026 - 11:48:00 EST


On 11/4/26 7:20 PM, Lorenzo Stoakes (ARM) wrote:
> For every relocation modpost invokes check_section_mismatch() to determine
> whether there is any kind of mismatch between the source and destination,
> and if so which classification applies.
>
> Each time it does this it invokes section_mismatch() which iterates
> through the sectioncheck[] array every time it's called.
>
> When walked a relocation section the source is fixed and there aren't many
> targets, so the same names are looked up over and over again.
>
> Therefore cache not only mismatch categorisation but also whether a
> mismatch even exists for a given section and look up the sections in the
> cache.
>
> Special indices (undefined, absolute, common) take the uncached path as
> before.
>
> This results in very significant speed ups for allmodconfig incremental
> builds.
>
> modpost is on the serial tail of every build that links vmlinux.
>
> Whole build, 128-thread Threadripper 9980X, best of N runs:
>
> before after delta
> -------------------------------
> x86 defconfig, touch mm/vma.c, gcc 8.5s 8.3s -0.14s (-2%)
> x86 defconfig, touch mm/vma.c, clang 7.7s 7.6s -0.13s (-2%)
> x86 allmodconfig, touch mm/vma.c, gcc 33.9s 29.4s -4.5s (-13%)
> x86 allmodconfig, touch mm/vma.c, clang 31.9s 27.9s -4.0s (-13%)
>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
Looks reasonable to me.

Reviewed-by: Petr Pavlu <petr.pavlu@xxxxxxxx>

--
Thanks,
Petr