[BUG] perf: hard lockup when using perf-sched
From: Li Zefan
Date: Wed Mar 17 2010 - 03:20:23 EST
An idea came to me that running perf-sched with a fork "bomb" might
reveal some bug.
So I wrote a program (attached), and did the following test:
# gcc fork.c
# ./a.out &
# perf sched record
After a few seconds, the machine froze, without printing any message.
I've tried the test both on v2.6.34-rc1 and v2.6.34-rc1-tip+.
I'll send you any other information you need.
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void)
{
int i;
int pid;
while (1) {
for (i = 0; i < 400; i++) {
pid = fork();
if (pid == 0) {
return 0;
} else if (pid < 0) {
fprintf(stderr, "faild to fork!\n");
continue;
}
}
for (i = 0; i < 400; i++)
if (wait(NULL) < 0)
break;
}
return 0;
}