Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jul 2005 16:39:12 +0200
From:      Benjamin Lutz <benlutz@datacomm.ch>
To:        questions@freebsd.org
Cc:        andre@sneakymustard.com
Subject:   Problems with make -j
Message-ID:  <200507271639.17254.benlutz@datacomm.ch>

next in thread | raw e-mail | index | archive | help
--nextPart1266737.UTpq9LBA3a
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hello,

As a pet project I've started to change /etc/rc so it uses make(1) to=20
execute the scripts in /etc/rc.d instead of executing them one after the=20
other like the standard /etc/rc does. The goal of the project is to speed=20
up boot time by executing rc.d scripts in parallel.

Now, if I don't specify a -j parameter this works just fine. I've written=20
a script that generates a Makefile with all the rc.d dependencies in it,=20
and using that the system boots just fine.

As soon as I add a -j parameter to make, even -j 1, things break though.=20
Scripts (eg, rc.subr) are being spewed to the screen several times, and=20
execution hangs at /etc/rc.d/adjkerntz (I think). I can pipe all this to=20
a log file with > make.log 2>&1. By the time make gets to adjkerntz and I=20
ctrl-c it, the logfile is slightly above 3MB.

Can anyone tell me why make behaves like this? If I had to guess I'd say=20
something's happening to the file descriptors, or something that make=20
needs for -j to work has not been set up. Btw, I have set up a memory=20
disk in /etc/tmp that make can use for -j (and I've patched make to use=20
that patch).

Here's what I use in /etc/rc now:

=3D=3D=3D=3D=3D SNIPPET START =3D=3D=3D=3D=3D
RC_MAKE=3D"1"

if [ -z "$RC_MAKE" ]; then
=A0 =A0 =A0 =A0 skip=3D"-s nostart"
=A0 =A0 =A0 =A0 [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && \
=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0skip=3D"$skip -s nojail"
=A0 =A0 =A0 =A0 files=3D`rcorder ${skip} /etc/rc.d/* 2>/dev/null`

=A0 =A0 =A0 =A0 for _rc_elem in ${files}; do
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 run_rc_script ${_rc_elem} ${_boot}
=A0 =A0 =A0 =A0 done
else
=A0 =A0 =A0 =A0 skip=3D"-DSKIP -DNOSTART"
=A0 =A0 =A0 =A0 [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && \
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0skip=3D"$skip -DNOJAIL"
=A0 =A0 =A0 =A0 /sbin/mdmfs -M -S -o sync -s 5m md0 /etc/tmp
=A0 =A0 =A0 =A0 /bin/rc_make -i -f /etc/Makefile ${skip} PARAM=3D${_boot}
=A0 =A0 =A0 =A0 /sbin/umount /dev/md0
=A0 =A0 =A0 =A0 /sbin/mdconfig -d -u md0
fi
=3D=3D=3D=3D=3D SNIPPET END =3D=3D=3D=3D=3D

Here's two example targets from the /etc/Makefile:

=3D=3D=3D=3D=3D SNIPPET START =3D=3D=3D=3D=3D
abi! LOGIN archdep
=2Eifdef !KEEP || NOJAIL
=2Eifdef !SKIP || (!NOJAIL)
=A0 =A0 =A0 =A0 . /etc/rc.subr && run_rc_script /etc/rc.d/abi ${PARAM}
=2Eendif
=2Eendif

accounting! mountcritremote
=2Eifdef !KEEP || NOJAIL
=2Eifdef !SKIP || (!NOJAIL)
=A0 =A0 =A0 =A0 . /etc/rc.subr && run_rc_script /etc/rc.d/accounting ${PARA=
M}
=2Eendif
=2Eendif
=3D=3D=3D=3D=3D SNIPPET END =3D=3D=3D=3D=3D

This currently works. As soon as I add "-j 1" or "-j 2" to the rc_make=20
call above, I get the behaviour described above.

Note that rc_make is standard make(1) except that TMPPAT has been changed=20
from /tmp to /etc/tmp.

Cheers
Benjamin

--nextPart1266737.UTpq9LBA3a
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQBC55yVgShs4qbRdeQRAnNqAJ0Rn+sldnmhKz8lCmRQvntJ2/W7/wCfd710
3hVqvfU0LcbVw3Apl1kuBWU=
=CtOa
-----END PGP SIGNATURE-----

--nextPart1266737.UTpq9LBA3a--



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