NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/53285: Build times tripled with make/job.c 1.193



The patch below, is probably a better 1st step.
It fixes the busy wait with no delay.

It does still poll the job token pipe, but only when we would
otherwise be busy waiting, rather when we have no need to.

Index: job.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/job.c,v
retrieving revision 1.194
diff -u -p -r1.194 job.c
--- job.c	13 May 2018 12:10:36 -0000	1.194
+++ job.c	13 May 2018 17:49:16 -0000
@@ -2944,14 +2944,15 @@ Job_TokenWithdraw(void)
     count = read(tokenWaitJob.inPipe, &tok, 1);
     if (count == 0)
 	Fatal("eof on job pipe!");
-    if (count < 0 && jobTokensRunning != 0) {
+    if (count < 0) {
 	if (errno != EAGAIN) {
 	    Fatal("job pipe read: %s", strerror(errno));
 	}
 	if (DEBUG(JOB))
 	    fprintf(debug_file, "(%d) blocked for token\n", getpid());
+	if (jobTokensRunning)
+	    return FALSE;
 	wantToken = 1;
-	return FALSE;
     }
 
     if (count == 1 && tok != '+') {


Home | Main Index | Thread Index | Old Index