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

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

--Apple-Mail=_4FB6C4C3-8A32-4F93-9855-15BDD6B701C2
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


On Feb 9, 2014, at 1:36 PM, Glen Barber <gjb@FreeBSD.org> wrote:

> 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_FSCHG
>  -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?

I can't give an authoritative answer, but there are a few
things to consider:

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

    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.

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.

HTH,

--=20
Marcel Moolenaar
marcel@xcllnt.net



--Apple-Mail=_4FB6C4C3-8A32-4F93-9855-15BDD6B701C2
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iEYEARECAAYFAlL8/4cACgkQpgWlLWHuifYkAgCfQfo0GOUJw+V/EwFgtOlRgJkd
ytYAnROn9MWmCsL+3dNWghI5e4zG8eWo
=aqza
-----END PGP SIGNATURE-----

--Apple-Mail=_4FB6C4C3-8A32-4F93-9855-15BDD6B701C2--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2510126A-ECD7-4DC7-A936-23824B233821>