localcru: negative time of 2360 usec for pid 33672 (fork_exit)
Don Bowman
don at sandvine.com
Sun Jun 13 16:54:32 GMT 2004
if you run the below test program, periodically
you will get:
localcru: negative time of 2360 usec for pid 33672 (fork_exit)
come out. On stable, you can set 'kern.timecounter.method=1'
to workaround this problem. Is there a fix for this on current?
$ cat fork_exit.c
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/resource.h>
char buf[16384];
static int
doit()
{
int fd;
char fname[] = "/tmp/fe/template.XXXXXXXXXX";
memset(buf,random(), sizeof(buf));
fd = open(mktemp(fname), O_RDWR|O_CREAT|O_TRUNC, 0666);
if (fd > 0)
{
write(fd, buf, sizeof(buf));
}
exit(0);
}
int
main(int argc, char **argv)
{
unsigned int i;
int s;
mkdir("/tmp/fe", 0777);
for (i = 0; ; i++)
{
if (fork() == 0)
{
doit();
}
if ((i % 1000) == 0)
{
while (waitpid(-1, &s, WNOHANG) > 0)
;
system("rm /tmp/fe/*");
}
}
return 0;
}
More information about the freebsd-current
mailing list