Skip site navigation (1)Skip section navigation (2)
Date:      02 Nov 1997 18:21:48 +0100
From:      Wolfram Schneider <wosch@cs.tu-berlin.de>
To:        "Jordan K. Hubbard" <jkh@time.cdrom.com>
Cc:        Wolfram Schneider <wosch@cs.tu-berlin.de>, smp@freebsd.org
Subject:   Re: Some SMP timing tests.
Message-ID:  <p1ipvojjjo3.fsf@panke.panke.de>
In-Reply-To: "Jordan K. Hubbard"'s message of Sat, 01 Nov 1997 10:52:18 -0800
References:  <5168.878410338@time.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Jordan K. Hubbard" <jkh@time.cdrom.com> writes:
> > If you have a Makefile with 5 targets (e.g. 4 *.c files, 1 manpage),
> > make can only create 5 jobs at once. Not surprising ;-)
> 
> A good point, but this doesn't quite explain the behavior during
> compiling things like libc, which has many targets which could be
> parallelized.

The bottleneck is the SUBDIR target which is not parallelized.

Try the patch and run `make -j<n> -I share/mk all' in /usr/src.
The patch split the SUBDIR variable into 4 variables SUBDIR1,
... SUBDIR4 and runs 4 subdir targets simultaneously.

Index: Makefile
===================================================================
RCS file: /usr/cvs/src/Makefile,v
retrieving revision 1.155
diff -u -r1.155 Makefile
--- Makefile	1997/10/10 13:02:36	1.155
+++ Makefile	1997/11/02 11:32:56
@@ -39,6 +39,11 @@
 
 # Put initial settings here.
 SUBDIR=
+SUBDIR1=
+SUBDIR2=
+SUBDIR3=
+SUBDIR4=
+
 
 # We must do share/info early so that installation of info `dir'
 # entries works correctly.  Do it first since it is less likely to
@@ -50,52 +55,52 @@
 # We must do include and lib early so that the perl *.ph generation
 # works correctly as it uses the header files installed by this.
 .if exists(include)
-SUBDIR+= include
+SUBDIR2+= include
 .endif
 .if exists(lib)
-SUBDIR+= lib
+SUBDIR2+= lib
 .endif
 
 .if exists(bin)
-SUBDIR+= bin
+SUBDIR3+= bin
 .endif
 .if exists(games) && !defined(NOGAMES)
-SUBDIR+= games
+SUBDIR1+= games
 .endif
 .if exists(gnu)
-SUBDIR+= gnu
+SUBDIR1+= gnu
 .endif
 .if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
-SUBDIR+= kerberosIV
+SUBDIR2+= kerberosIV
 .endif
 .if exists(libexec)
-SUBDIR+= libexec
+SUBDIR2+= libexec
 .endif
 .if exists(sbin)
-SUBDIR+= sbin
+SUBDIR4+= sbin
 .endif
 .if exists(share) && !defined(NOSHARE)
-SUBDIR+= share
+SUBDIR3+= share
 .endif
 .if exists(sys)
-SUBDIR+= sys
+SUBDIR4+= sys
 .endif
 .if exists(usr.bin)
-SUBDIR+= usr.bin
+SUBDIR3+= usr.bin
 .endif
 .if exists(usr.sbin)
-SUBDIR+= usr.sbin
+SUBDIR4+= usr.sbin
 .endif
 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
-SUBDIR+= secure
+SUBDIR2+= secure
 .endif
 .if exists(lkm) && !defined(NOLKM)
-SUBDIR+= lkm
+SUBDIR4+= lkm
 .endif
 
 # etc must be last for "distribute" to work
 .if exists(etc) && make(distribute)
-SUBDIR+= etc
+SUBDIR4+= etc
 .endif
 
 # These are last, since it is nice to at least get the base system
Index: share/mk/bsd.subdir.mk
===================================================================
RCS file: /usr/cvs/src/share/mk/bsd.subdir.mk,v
retrieving revision 1.18
diff -u -r1.18 bsd.subdir.mk
--- bsd.subdir.mk	1997/06/21 15:40:34	1.18
+++ bsd.subdir.mk	1997/11/02 11:29:28
@@ -46,7 +46,57 @@
 			cd ${.CURDIR}/$${edir}; \
 		fi; \
 		${MAKE} ${.TARGET:realinstall=install} DIRPRFX=${DIRPRFX}$$edir/); \
-	done
+	done; \
+	for entry in ${SUBDIR1}; do \
+		(if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
+			${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE}"; \
+			edir=$${entry}.${MACHINE}; \
+			cd ${.CURDIR}/$${edir}; \
+		else \
+			${ECHODIR} "===> ${DIRPRFX}$$entry"; \
+			edir=$${entry}; \
+			cd ${.CURDIR}/$${edir}; \
+		fi; \
+		${MAKE} ${.TARGET:realinstall=install} DIRPRFX=${DIRPRFX}$$edir/); \
+	done & \
+	for entry in ${SUBDIR2}; do \
+		(if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
+			${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE}"; \
+			edir=$${entry}.${MACHINE}; \
+			cd ${.CURDIR}/$${edir}; \
+		else \
+			${ECHODIR} "===> ${DIRPRFX}$$entry"; \
+			edir=$${entry}; \
+			cd ${.CURDIR}/$${edir}; \
+		fi; \
+		${MAKE} ${.TARGET:realinstall=install} DIRPRFX=${DIRPRFX}$$edir/); \
+	done & \
+	for entry in ${SUBDIR3}; do \
+		(if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
+			${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE}"; \
+			edir=$${entry}.${MACHINE}; \
+			cd ${.CURDIR}/$${edir}; \
+		else \
+			${ECHODIR} "===> ${DIRPRFX}$$entry"; \
+			edir=$${entry}; \
+			cd ${.CURDIR}/$${edir}; \
+		fi; \
+		${MAKE} ${.TARGET:realinstall=install} DIRPRFX=${DIRPRFX}$$edir/); \
+	done & \
+	for entry in ${SUBDIR}; do \
+		(if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
+			${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE}"; \
+			edir=$${entry}.${MACHINE}; \
+			cd ${.CURDIR}/$${edir}; \
+		else \
+			${ECHODIR} "===> ${DIRPRFX}$$entry"; \
+			edir=$${entry}; \
+			cd ${.CURDIR}/$${edir}; \
+		fi; \
+		${MAKE} ${.TARGET:realinstall=install} DIRPRFX=${DIRPRFX}$$edir/); \
+	done & \
+	wait
+
 
 ${SUBDIR}::
 	@if test -d ${.TARGET}.${MACHINE}; then \


-- 
Wolfram Schneider   <wosch@apfel.de>   http://www.apfel.de/~wosch/



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