depend + all vs dependall
Bruce Evans
bde at zeta.org.au
Tue Apr 1 23:55:31 PST 2003
On Wed, 2 Apr 2003, Ruslan Ermilov wrote:
> On Sun, Mar 30, 2003 at 04:12:09PM +1000, Bruce Evans wrote:
> [...]
> > > time make buildworld -j 8 -s
> >
> > Note that all benchmarks using -j are invalid because of nondeterministic
> > wait times of up to 100 msec for each job. This pessimizes makeworld -j 4
> > times by about 20% on a non-dual Athlon XP1600, and can't do good things
> > for the variance. The pessimization is larger on faster machines of
> > course. This is fixed in NetBSD. FreeBSD only has the hackaround of
> > reducing the timeout from 500 msec to 100 msec.
> >
> FreeBSD also provides disabled at the moment kqueue(2) based
> implementation of the above wait. Now that Jonathan is back,
> perhaps he could look into the issues if they still exist?
I tried this first. It fixed make and didn't cause any kernel problems
here, but is not necessary with correct programming of select(). It
might be a micro-optimization relative to select though -- a slopy
benchmark showed that it was 0.2% faster for makeworld.
References:
%%%
Index: main.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/make/main.c,v
retrieving revision 1.81
diff -u -2 -r1.81 main.c
--- main.c 17 Dec 2002 04:26:22 -0000 1.81
+++ main.c 21 Mar 2003 23:41:47 -0000
@@ -411,4 +411,8 @@
}
+void
+catch_child(int sig)
+{
+}
/*-
@@ -452,4 +456,20 @@
/* avoid faults on read-only strings */
static char syspath[] = _PATH_DEFSYSPATH;
+
+ {
+ /*
+ * Catch SIGCHLD so that we get kicked out of select() when we
+ * need to look at a child. This is only known to matter for the
+ * -j case (perhaps without -P).
+ *
+ * XXX this is intentionally misplaced.
+ */
+ struct sigaction sa;
+
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = SA_RESTART | SA_NOCLDSTOP;
+ sa.sa_handler = catch_child;
+ sigaction(SIGCHLD, &sa, NULL);
+ }
#ifdef WANT_ENV_MKLVL
%%%
%%%
RCS file: /home/NetBSD/NetBSD-cvs/src/usr.bin/make/job.c,v
Working file: job.c
head: 1.75
...
----------------------------
revision 1.73
date: 2002/11/16 22:22:23; author: gson; state: Exp; lines: +98 -57
Fixed race condition that would cause make -j to pause for five
seconds if a SIGCHLD arrived while make was not blocked in poll(),
by making the SIGCHLD handler write to a pipe included in the poll.
Avoided the need to implement a duplicate fix for the USE_SELECT case
by emulating poll() in terms of select() when USE_SELECT is defined.
Fixes bin/18895.
----------------------------
...
----------------------------
revision 1.37
date: 2000/12/05 15:20:10; author: sommerfeld; state: Exp; lines: +35 -4
correct performance regression of recent change from select() to
poll() for parallel make:
- Make the poll() code behave more like the select() code: sleep for
a bit waiting for output rather than busy-wait (eww).
- Install a no-op SIGCHLD handler so that poll/select wake up early
(with -1/EINTR) when a child exits.
- Change the default sleep time from 500ms to 5 seconds since we now
wake up promptly when a child exits.
----------------------------
%%%
%%%
RCS file: /home/ncvs/src/usr.bin/make/job.h,v
Working file: job.h
head: 1.20
...
----------------------------
revision 1.8
date: 1997/04/21 20:32:11; author: phk; state: Exp; lines: +2 -2
branches: 1.8.2;
In these XXX MHz days, waiting 500ms for a process to do something is
really far too long. Let us try 100ms instead, if you have a PP200,
maybe that's even too long. This should speed up make -j# builds.
I wonder why SIGCHLD isn't used...
----------------------------
%%%
Bruce
More information about the freebsd-arch
mailing list