Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Kernel building question (Is -j8 safe and correct?)

222 views
Skip to first unread message

Antonio Russo

unread,
Jun 11, 2021, 10:10:03 PM6/11/21
to
Hello,

I'm trying to build a Debian bullseye kernel (with KASAN enabled, but that's irrelevant).
I'm following [1], and the critical command

$ fakeroot make -f debian/rules.gen binary-arch_i386_none_real

does not suggest using -j8 (or -jnumber_of_cores).

1. Is it safe to add -j8 ?
2. Will this indeed give me the speed up I want and expect on my multi-core processor?
3. If both of the above are true, why isn't something like that suggested on [1]?

Best,
Antonio

[1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official

Philipp Hahn

unread,
Jun 13, 2021, 9:40:03 AM6/13/21
to
Hello Anionio,

Am 12.06.21 um 03:34 schrieb Antonio Russo:
> I'm trying to build a Debian bullseye kernel (with KASAN enabled, but that's irrelevant).
> I'm following [1], and the critical command
>
> $ fakeroot make -f debian/rules.gen binary-arch_i386_none_real
>
> does not suggest using -j8 (or -jnumber_of_cores).
>
> 1. Is it safe to add -j8 ?

That depends on many factors, most importantly how many CPU cores your
build host has and how many of them you want to use:
- if this is a single-user system and you're the only user and you don't
want to do much in parallel: yes
- using all CPU cores on a multi-user system might get you complaints
from the other users.
- watching videos while waiting for the compile to finish might be
problematic.

> 2. Will this indeed give me the speed up I want and expect on my multi-core processor?

Probably yes, but see above. It also depends on how much RAM you have
and how fast your disk/SSD is.

> 3. If both of the above are true, why isn't something like that suggested on [1]?

Debian does not know your specifics and thus does not use parallel build
by default. You must give permissions first:

> export DEB_BUILD_OPTIONS="parallel=$(nproc)"

See
<https://www.debian.org/doc/debian-policy/ch-source.html#main-building-script-debian-rules>.

For example the VMs and hosts of Debians build system are dedicated to
building packages. They are controlled by the Debian admins and parallel
building is enabled there by default - if applicable.
If you have to build many packages it might be more effective to build
multiple source packages in parallel, as there are still packages which
can only use one CPU. Mixing both strategies is also an option, but
heavily depends on your usage scenario.

Philipp

Ben Hutchings

unread,
Jun 14, 2021, 6:10:03 PM6/14/21
to
On Sun, 2021-06-13 at 15:07 +0200, Philipp Hahn wrote:
[...]
> > 3. If both of the above are true, why isn't something like that suggested on [1]?
>
> Debian does not know your specifics and thus does not use parallel build
> by default.
>

Debian *does* use parallel builds by default. But that default
behaviour is implemented in dpkg-buildpackage, so doesn't apply in this
case.

> You must give permissions first:
>
>  > export DEB_BUILD_OPTIONS="parallel=$(nproc)"
>
> See
> <https://www.debian.org/doc/debian-policy/ch-source.html#main-building-script-debian-rules>.
>

That has no effect in this case. The makefile being used is
debian/rules.gen, not debian/rules.


Ben.

--
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert Camus
signature.asc

Ben Hutchings

unread,
Jun 14, 2021, 6:10:03 PM6/14/21
to
On Fri, 2021-06-11 at 19:34 -0600, Antonio Russo wrote:
> Hello,
>
> I'm trying to build a Debian bullseye kernel (with KASAN enabled, but that's irrelevant).
> I'm following [1], and the critical command
>
> $ fakeroot make -f debian/rules.gen binary-arch_i386_none_real
>
> does not suggest using -j8 (or -jnumber_of_cores).
>
> 1. Is it safe to add -j8 ?

Yes.

> 2. Will this indeed give me the speed up I want and expect on my multi-core processor?

Yes.

> 3. If both of the above are true, why isn't something like that suggested on [1]?

Because no-one thought to add them yet.

Please report this as a bug in the "kernel-handbook" package (which is
the source for this web site). If you can provide a patch, that would
be even better.

Ben.
signature.asc
0 new messages