[PATCH v2 17/21] objtool: decode instructions and resolve branch targets in parallel
David Laight
david.laight.linux at gmail.com
Tue Sep 15 04:29:59 PDT 2026
On Tue, 15 Sep 2026 11:09:25 +0100
"Lorenzo Stoakes (ARM)" <ljs at kernel.org> wrote:
> > > +static unsigned int decode_threads(unsigned long text_size)
> > > +{
> > > + const long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
> > > +
> > > + if (text_size < DECODE_THREADED_MIN_TEXT || nr_cpus < 2)
> > > + return 1;
The text_size check ought to be before the sysconf() call.
> > > +
> > > + return min_t(unsigned int, nr_cpus, DECODE_MAX_THREADS);
Why min_t() - you might as well make nr_cpus 'unsigned int'.
> > > +}
> >
> > No, anything using _SC_NPROCESSORS_ONLN internally is wrong, whether its
> > pigz or objtool.
>
> Why? We shouldn't cap a 4 CPU box to 4 CPUs?
You almost certainly don't want to use more...
(Unless they end up waiting for disk)
>
> The idea is that the empirically obtained 16 core limit should naturally be
> capped to the number of CPUs.
The 'empirical' limit is very likely to be system dependant.
There might also be situations where you don't want the build to run as fast
as possible because the system is performing other workloads.
(Not to mention if you have had to add tracing to find a bug.)
>
> I guess in a world where make hands jobs off this could be dropped, though,
> if the complexity there seems worthwhile.
You need to pull tokens out of the make pipe :-)
David
More information about the linux-riscv
mailing list