> > Reverting the fork patch makes all these problems go away on my machine.
>
> Reverting it outright may be an acceptable approach. I'll think about
> it: the arguments _for_ the patch are true and real, and it shows up as
> real improvements on some things..
I agree with the reasoning for running the child first. Maybe the real
problem is somewhere else. I wrote two test programs to quantify the
behaviour. If I run "./fork 0.2" and "./lat 0.15" at the same time, lat
shows regular 160ms scheduling delays. (With the old fork.c the scheduling
delay is 20ms + epsilon as expected.)
Maybe some code path just forgets to reschedule?
-------- fork.c --------
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
int main(int argc, char* argv[])
{
double childTime = atof(argv[1]);
for (;;) {
int child = fork();
if (child == -1) {
printf("fork error\n");
exit(0);
} else if (child > 0) {
while (waitpid(child, NULL, 0) != child)
;
printf("."); fflush(stdout);
} else {
struct timeval tv1, tv2;
double t;
gettimeofday(&tv1, NULL);
for (;;) {
gettimeofday(&tv2, NULL);
t = (tv2.tv_sec - tv1.tv_sec) +
(tv2.tv_usec - tv1.tv_usec) / 1000000.0;
if (t > childTime)
break;
}
_exit(0);
}
}
return 0;
}
-------- lat.c --------
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
int main(int argc, char* argv[])
{
double tLimit = 0.03;
if (argc > 1)
tLimit = atof(argv[1]);
for (;;) {
struct timeval tv1, tv2;
double t;
gettimeofday(&tv1, NULL);
usleep(10000);
gettimeofday(&tv2, NULL);
t = (tv2.tv_sec - tv1.tv_sec) +
(tv2.tv_usec - tv1.tv_usec) / 1000000.0;
if (t > tLimit)
printf("t:%g\n", t);
}
return 0;
}
-- Peter Österlund peter.osterlund@mailbox.swipnet.se Sköndalsvägen 35 http://home1.swipnet.se/~w-15919 S-128 66 Sköndal +46 8 942647 Sweden
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/