Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Mar 2014 11:05:00 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Dimitry Andric <dim@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r263778 - in head: bin lib lib/clang sbin share/mk usr.bin usr.sbin
Message-ID:  <AA90F6B0-3A7A-473D-82C2-CFDFD263E9AC@gmail.com>
In-Reply-To: <201403262230.s2QMUdH6021943@svn.freebsd.org>
References:  <201403262230.s2QMUdH6021943@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Why not have this =91opt out=92 rather than =91opt in=92 like it is now? =
Are there any known bad dependencies this introduces?

Warner

On Mar 26, 2014, at 4:30 PM, Dimitry Andric <dim@freebsd.org> wrote:

> Author: dim
> Date: Wed Mar 26 22:30:38 2014
> New Revision: 263778
> URL: http://svnweb.freebsd.org/changeset/base/263778
>=20
> Log:
>  Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to =
process
>  all the SUBDIR entries in parallel, instead of serially.  Apply this
>  option to a selected number of Makefiles, which can greatly speed up =
the
>  build on multi-core machines, when using make -j.
>=20
>  This can be extended to more Makefiles later on, whenever they are
>  verified to work correctly with parallel building.
>=20
>  I tested this on a 24-core machine, with make -j48 buildworld (N =3D =
6):
>=20
>                  before    stddev       after    stddev
>                  =3D=3D=3D=3D=3D=3D=3D   =3D=3D=3D=3D=3D=3D       =
=3D=3D=3D=3D=3D=3D=3D  =3D=3D=3D=3D=3D=3D
>  real time        1741.1     16.5         959.8     2.7
>  user time       12468.7     16.4       14393.0    16.8
>  sys  time        1825.0     54.8        2110.6    22.8
>=20
>  (user+sys)/real     8.2                   17.1
>=20
>  E.g. the build was approximately 45% faster in real time.  On =
machines
>  with less cores, or with lower -j settings, the speedup will not be =
as
>  impressive.  But at least you can now almost max out a machine with
>  buildworld!
>=20
>  Submitted by:	jilles
>  MFC after:	2 weeks
>=20
> Modified:
>  head/bin/Makefile
>  head/lib/Makefile
>  head/lib/clang/Makefile
>  head/sbin/Makefile
>  head/share/mk/bsd.subdir.mk
>  head/usr.bin/Makefile
>  head/usr.sbin/Makefile
>=20
> Modified: head/bin/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/bin/Makefile	Wed Mar 26 20:43:40 2014	(r263777)
> +++ head/bin/Makefile	Wed Mar 26 22:30:38 2014	(r263778)
> @@ -60,4 +60,6 @@ SUBDIR+=3D	tests
>=20
> SUBDIR:=3D	${SUBDIR:O}
>=20
> +SUBDIR_PARALLEL=3D
> +
> .include <bsd.subdir.mk>
>=20
> Modified: head/lib/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/lib/Makefile	Wed Mar 26 20:43:40 2014	(r263777)
> +++ head/lib/Makefile	Wed Mar 26 22:30:38 2014	(r263778)
> @@ -276,4 +276,8 @@ afterinstall:
> 	${INSTALL_SYMLINK} ../include ${DESTDIR}/usr/lib/include
> .endif
>=20
> +.if !make(install)
> +SUBDIR_PARALLEL=3D
> +.endif
> +
> .include <bsd.subdir.mk>
>=20
> Modified: head/lib/clang/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/lib/clang/Makefile	Wed Mar 26 20:43:40 2014	=
(r263777)
> +++ head/lib/clang/Makefile	Wed Mar 26 22:30:38 2014	=
(r263778)
> @@ -147,4 +147,6 @@ SUBDIR+=3Dliblldb \
>=20
> SUBDIR+=3D include
>=20
> +SUBDIR_PARALLEL=3D
> +
> .include <bsd.subdir.mk>
>=20
> Modified: head/sbin/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sbin/Makefile	Wed Mar 26 20:43:40 2014	=
(r263777)
> +++ head/sbin/Makefile	Wed Mar 26 22:30:38 2014	=
(r263778)
> @@ -126,4 +126,6 @@ SUBDIR+=3D	tests
>=20
> SUBDIR:=3D	${SUBDIR:O}
>=20
> +SUBDIR_PARALLEL=3D
> +
> .include <bsd.subdir.mk>
>=20
> Modified: head/share/mk/bsd.subdir.mk
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/share/mk/bsd.subdir.mk	Wed Mar 26 20:43:40 2014	=
(r263777)
> +++ head/share/mk/bsd.subdir.mk	Wed Mar 26 22:30:38 2014	=
(r263778)
> @@ -71,7 +71,26 @@ ${SUBDIR}: .PHONY .MAKE
> .for __target in all all-man checkdpadd clean cleandepend cleandir \
>     cleanilinks depend distribute lint maninstall manlint obj objlink =
\
>     realinstall regress tags ${SUBDIR_TARGETS}
> +.ifdef SUBDIR_PARALLEL
> +.for __dir in ${SUBDIR}
> +${__target}: ${__target}_subdir_${__dir}
> +${__target}_subdir_${__dir}: .MAKE
> +	@${_+_}set -e; \
> +		if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \
> +			${ECHODIR} "=3D=3D=3D> =
${DIRPRFX}${__dir}.${MACHINE_ARCH} (${__target:realinstall=3Dinstall})"; =
\
> +			edir=3D${__dir}.${MACHINE_ARCH}; \
> +			cd ${.CURDIR}/$${edir}; \
> +		else \
> +			${ECHODIR} "=3D=3D=3D> ${DIRPRFX}${__dir} =
(${__target:realinstall=3Dinstall})"; \
> +			edir=3D${__dir}; \
> +			cd ${.CURDIR}/$${edir}; \
> +		fi; \
> +		${MAKE} ${__target:realinstall=3Dinstall} \
> +		    DIRPRFX=3D${DIRPRFX}$$edir/
> +.endfor
> +.else
> ${__target}: _SUBDIR
> +.endif
> .endfor
>=20
> .for __target in files includes
>=20
> Modified: head/usr.bin/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/usr.bin/Makefile	Wed Mar 26 20:43:40 2014	=
(r263777)
> +++ head/usr.bin/Makefile	Wed Mar 26 22:30:38 2014	=
(r263778)
> @@ -379,4 +379,6 @@ SUBDIR+=3D	svn
>=20
> SUBDIR:=3D	${SUBDIR:O}
>=20
> +SUBDIR_PARALLEL=3D
> +
> .include <bsd.subdir.mk>
>=20
> Modified: head/usr.sbin/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/usr.sbin/Makefile	Wed Mar 26 20:43:40 2014	=
(r263777)
> +++ head/usr.sbin/Makefile	Wed Mar 26 22:30:38 2014	=
(r263778)
> @@ -320,4 +320,6 @@ SUBDIR+=3D	wpa
>=20
> SUBDIR:=3D	${SUBDIR:O}
>=20
> +SUBDIR_PARALLEL=3D
> +
> .include <bsd.subdir.mk>
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AA90F6B0-3A7A-473D-82C2-CFDFD263E9AC>