Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Feb 2014 14:14:01 -0500
From:      Glen Barber <gjb@FreeBSD.org>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        freebsd-toolchain@FreeBSD.org
Subject:   Re: bmake(1) "sometimes" honors '-j' ?
Message-ID:  <20140213191401.GJ1667@glenbarber.us>
In-Reply-To: <2510126A-ECD7-4DC7-A936-23824B233821@xcllnt.net>
References:  <20140209213618.GA63417@glenbarber.us> <2510126A-ECD7-4DC7-A936-23824B233821@xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--zYo4Elh1vtcYNvbq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Feb 13, 2014 at 09:23:19AM -0800, Marcel Moolenaar wrote:
>=20
> On Feb 9, 2014, at 1:36 PM, Glen Barber <gjb@FreeBSD.org> wrote:
>=20
> > Maybe there is an obvious answer to this, or maybe I just do not
> > understand how computers work.
> >=20
> > For snapshot builds for RPI-B and BEAGLEBONE, I am hard-coding '-j10'
> > for buildworld and '-j6' for buildkernel, because these values are
> > somewhat "safe" considering various race conditions with high '-j'
> > values.  Crochet sets the '-j' value to '1', if WORLDJOBS and
> > KERNJOBS are not set, so what I end up with is basically:
> > 'make [...] -j10 -j1 ${.TARGET}'.
> >=20
> > What I see in ps(1) is a bit confusing to me, though.
> >=20
> > For example, the following suggests '-j10' is being honored for the
> > 'libraries' target, but '-j1' is being forced for the 'buildworld'
> > target, and I'm not sure I understand why.  (Lines broken up for
> > readability.)
> >=20
> >  root@grind:~ # ps auxww | grep make | grep 'j'
> >=20
> >  root  67766    0.0  0.0  9024  1048  4  S+    7:20PM       0:03.02 make
> >  TARGET_ARCH=3Darmv6 SRCCONF=3D/dev/null __MAKE_CONF=3D/dev/null -j10 -=
j 1 buildworld
> >=20
> >  root  13112    0.0  0.0  9024  1488  4  S     8:24PM       0:00.94 make
> >  -j10 -f Makefile.inc1 DESTDIR=3D/usr/obj/arm.armv6/usr/src/tmp -DNO_FS=
CHG
> >  -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN -DNO_PROFILE
> >  -DNO_TESTS libraries
> >=20
> > So, if I am reading this correctly, the 'libraries' target is honoring
> > the '-j10', and 'buildworld' is honoring the later-specified '-j1'.
> >=20
> > Am I reading this incorrectly, or is this something I just do not
> > understand about our toolchain?
>=20
> I can't give an authoritative answer, but there are a few
> things to consider:
>=20
> 1.  MAKEFLAGS is set by make(1) for later use. There's also the
>     .MAKEFLAGS variant. I don't know the *exact* difference
>     between them, but our makefile, including Makefile.inc1, uses
>     the variable and passes it to sub-makes.
> 2.  make/bmake itself sets MAKEFLAGS/.MAKEFLAGS and automatically
>     passes it to sub-makes. So when a makefile sets it, it's to
>     override the default.
> 3.  The .MAKEFLAGS variable holds the exact set of options passed
>     to make. For example:
> 	% make -j10 -j1 -V .MAKEFLAGS
> 	 -j 10 -j 1 -V .MAKEFLAGS
>=20
>     What this means is that -j10 gets passed around and as such
>     can be used, not withstanding the fact that -j1 follows and
>     make itself may use that instead. Point 1 above applies.
>=20
> For best results, pass only 1 -j flag or alternatively we need
> to fix our makefiles to only keep the last -j in MAKEFLAGS, etc.
>=20

In this specific scenario, it was not intentional.  I had left out
a configuration entry, and the intended '-j10' was being overridden.

Anyway, thank you for the explanation.  It does make sense.

Glen


--zYo4Elh1vtcYNvbq
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQIcBAEBCAAGBQJS/Rl5AAoJELls3eqvi17QVWEP/2niaaHSIFTzBQRHf20NRvw6
yFXOU4Kezzx6X0ZDeNiURFBXs7NxFIT6H9IcCddBzAVQa992ScmsHyLx5TxyAkBv
i7Qr7mhkFvyhtI7jI4+5qBFjuYhxisHMlJbacDlicfWGEkMO2npsMVLONy/Bd7v3
rlxATSliE+a65dpHi3XMT9FiABjlsqPLpY0eZhYBtoSSd6zMAWkGk0jit8nfQUzJ
exLZ7qUouwQktA6wNXRuK+MUDK2ii+MsZuM/pP/aNjC8vIesyijff/neYuJ2IAxS
CHvEVUWhIwc4heOXa5LEb9lvyV3l61OkIXPb4YnMyiCO+ynMxXDIbzAf/DqlN09+
ieDC6SbAPRoZJrJ+yMc7t+F1rjZ7uqucLp4SaLNz+opbeTDMvDdki5id0Q3FKsNf
9AOvhrVpOj5csRt4kU/4bFaHw0ySRepWcJufCMWCGoFjHYcgzyugh6QFdqXFbvKA
1fsWr6KYeHxOLLBSN/ock0Ic8Emn1kHm9sDk2Pf+XnjRG52PM9rKRXefcz1Qubme
I4sDra2o43AhdhNIbgEozE8b+NfuHnR251WivoPh+N2S3i9JnNGRAIk8FvTDqelz
OwYSu6KtZG8pjw5rvDcsVHXQKoA299Nc/a62a8NN4aaR+o7ACMYHLj8JuVs9VPcF
ihmK6rewlXyKXIOxBfpk
=4JmH
-----END PGP SIGNATURE-----

--zYo4Elh1vtcYNvbq--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140213191401.GJ1667>