Re: [PATCH v3 00/17] perf build: Reduce build time by nearly half
From: Namhyung Kim
Date: Fri May 15 2026 - 14:29:13 EST
On Thu, May 14, 2026 at 03:23:34PM -0700, Ian Rogers wrote:
> On Thu, May 14, 2026 at 3:06 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > On Thu, May 14, 2026 at 09:33:52AM -0700, Ian Rogers wrote:
> > > This patch series refactors Kbuild internals, BPF skeleton generation,
> > > Python AST pre-computation, and foundational tooling dependencies across
> > > the perf tool build system. By eliminating umbrella target synchronization
> > > barriers, decoupling static library prerequisites, parallelizing single-core
> > > script generators, and eradicating redundant feature checks, this series
> > > unlocks absolute theoretical peak multi-core concurrency during Kbuild startup.
> > >
> > > On a 28-core build workstation (make -j28 all from scratch), clean build
> > > latency improves by over 49%:
> > >
> > > Before:
> > > real 0m29.006s
> > > user 2m46.019s
> > > sys 0m30.610s
> > >
> > > After:
> > > real 0m14.782s
> > > user 2m39.527s
> > > sys 0m22.938s
> > >
> > > Saving 14.2 full seconds time per clean build. Furthermore, nothing to
> > > build incremental builds are improved by nearly 7x:
> > >
> > > Before:
> > > real 0m11.528s
> > > user 0m9.633s
> > > sys 0m6.965s
> > >
> > > After:
> > > real 0m1.729s
> > > user 0m1.600s
> > > sys 0m0.884s
> >
> > I've quickly checked it with latency profiling like below:
> >
> > $ perf record --latency -- make -C tools/perf
> >
> > $ perf report --latency -s comm
> >
> > The result looks like this.
> >
> > Before:
> > #
> > # Samples: 715K of event 'cpu/cycles/Pu'
> > # Event count (approx.): 422452811481
> > #
> > # Latency Overhead Command
> > # ........ ........ ...............
> > #
> > 45.28% 71.33% cc1
> > 34.48% 16.92% python3
> > 11.15% 2.21% ld
> > 2.58% 1.51% x86_64-linux-gn
> > 2.22% 0.99% cc1plus
> > 0.71% 0.63% sh
> > 0.69% 0.14% llvm-config
> > 0.62% 0.56% clang
> > 0.57% 4.40% shellcheck
> > 0.44% 0.12% perl
> >
> > After:
> > #
> > # Samples: 709K of event 'cpu/cycles/Pu'
> > # Event count (approx.): 416654798495
> > #
> > # Latency Overhead Command
> > # ........ ........ ...............
> > #
> > 64.99% 71.16% cc1
> > 15.07% 1.81% ld
> > 7.14% 17.59% python3
> > 3.66% 1.53% x86_64-linux-gn
> > 3.48% 0.75% cc1plus
> > 1.11% 4.43% shellcheck
> > 1.09% 0.74% sh
> > 0.86% 0.59% clang
> > 0.77% 0.12% perl
> > 0.45% 0.23% make
> >
> > Now I see a big drop in the latency from python. And the llvm-config
> > doesn't show up in the top 10.
>
> This looks good. What is "x86_64-linux-gn", and since we default off
> LIBPERL, why does perl show up in the commands?
I don't know exactly, but it seems we have some path to run perl during
the build even LIBPERL is off. This is what `perf report --tasks` shows.
3577076 3577076 3576925 | sh
3577077 3577077 3577076 | make
3577078 3577078 3577077 | sh
3577079 3577079 3577078 | gcc
3577081 3577081 3577079 | cc1
3577080 3577080 3577078 | grep
3577082 3577082 3577077 | which
3577083 3577083 3577077 | sh
3577084 3577084 3577083 | perl
3577085 3577085 3577077 | sh
3577086 3577086 3577085 | perl
3577087 3577087 3577086 | pwd
3577088 3577088 3577086 | sh
3577089 3577089 3577088 | x86_64-linux-gn
3577090 3577090 3577089 | cc1
Thanks,
Namhyung