From owner-freebsd-arch@FreeBSD.ORG Tue Apr 1 23:55:31 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0E9F037B401; Tue, 1 Apr 2003 23:55:31 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4078343FA3; Tue, 1 Apr 2003 23:55:27 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id RAA00948; Wed, 2 Apr 2003 17:55:24 +1000 Date: Wed, 2 Apr 2003 17:55:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Ruslan Ermilov In-Reply-To: <20030402065855.GA161@sunbay.com> Message-ID: <20030402174522.X25929@gamplex.bde.org> References: <20030329.163343.53040416.imp@bsdimp.com> <20030330150957.M13638@gamplex.bde.org> <20030402065855.GA161@sunbay.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: arch@FreeBSD.org cc: Jonathan Lemon cc: "M. Warner Losh" Subject: Re: depend + all vs dependall X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Apr 2003 07:55:31 -0000 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